Skip to content

Commit eda0047

Browse files
committed
mm: make the page fault mmap locking killable
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>
1 parent c2508ec commit eda0047

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

mm/memory.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5279,8 +5279,7 @@ static inline bool get_mmap_lock_carefully(struct mm_struct *mm, struct pt_regs
52795279
return false;
52805280
}
52815281

5282-
mmap_read_lock(mm);
5283-
return true;
5282+
return !mmap_read_lock_killable(mm);
52845283
}
52855284

52865285
static inline bool mmap_upgrade_trylock(struct mm_struct *mm)
@@ -5304,8 +5303,7 @@ static inline bool upgrade_mmap_lock_carefully(struct mm_struct *mm, struct pt_r
53045303
if (!search_exception_tables(ip))
53055304
return false;
53065305
}
5307-
mmap_write_lock(mm);
5308-
return true;
5306+
return !mmap_write_lock_killable(mm);
53095307
}
53105308

53115309
/*

0 commit comments

Comments
 (0)