lockdep, mm: fix might_fault() annotation
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Mon, 12 Jan 2009 12:02:11 +0000 (13:02 +0100)
committerIngo Molnar <mingo@elte.hu>
Mon, 12 Jan 2009 12:09:18 +0000 (13:09 +0100)
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>
mm/memory.c

index e009ce8708597fe3c7542a92ec9201fe8d5f73b6..c2d4c477e5bbea00706878db6ba11011945466bd 100644 (file)
@@ -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