Skip to content

Commit

Permalink
lockdep, mm: fix might_fault() annotation
Browse files Browse the repository at this point in the history
Some code (nfs/sunrpc) uses socket ops on kernel memory while holding
the mmap_sem, this is safe because kernel memory doesn't get paged out,
therefore we'll never actually fault, and the might_fault() annotations
will generate false positives.

Reported-by: "J. Bruce Fields" <bfields@fieldses.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Jan 12, 2009
1 parent 9d07933 commit 95156f0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -3165,6 +3165,15 @@ void print_vma_addr(char *prefix, unsigned long ip)
#ifdef CONFIG_PROVE_LOCKING
void might_fault(void)
{
/*
* Some code (nfs/sunrpc) uses socket ops on kernel memory while
* holding the mmap_sem, this is safe because kernel memory doesn't
* get paged out, therefore we'll never actually fault, and the
* below annotations will generate false positives.
*/
if (segment_eq(get_fs(), KERNEL_DS))
return;

might_sleep();
/*
* it would be nicer only to annotate paths which are not under
Expand Down

0 comments on commit 95156f0

Please sign in to comment.