Skip to content

Commit

Permalink
mm: make the page fault mmap locking killable
Browse files Browse the repository at this point in the history
This is done as a separate patch from introducing the new
lock_mm_and_find_vma() helper, because while it's an obvious change,
it's not what x86 used to do in this area.

We already abort the page fault on fatal signals anyway, so why should
we wait for the mmap lock only to then abort later? With the new helper
function that returns without the lock held on failure anyway, this is
particularly easy and straightforward.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Linus Torvalds committed Jun 24, 2023
1 parent c2508ec commit eda0047
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -5279,8 +5279,7 @@ static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regs
return false;
}

mmap_read_lock(mm);
return true;
return !mmap_read_lock_killable(mm);
}

static inline bool mmap_upgrade_trylock(struct mm_struct *mm)
Expand All @@ -5304,8 +5303,7 @@ static inline bool upgrade_mmap_lock_carefully(struct mm_struct *mm, struct pt_r
if (!search_exception_tables(ip))
return false;
}
mmap_write_lock(mm);
return true;
return !mmap_write_lock_killable(mm);
}

/*
Expand Down

0 comments on commit eda0047

Please sign in to comment.