Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
[cascardo/linux.git] / mm / memory.c
index 22e037e..17734c3 100644 (file)
@@ -3737,7 +3737,7 @@ void print_vma_addr(char *prefix, unsigned long ip)
 }
 
 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP)
-void might_fault(void)
+void __might_fault(const char *file, int line)
 {
        /*
         * Some code (nfs/sunrpc) uses socket ops on kernel memory while
@@ -3747,21 +3747,15 @@ void might_fault(void)
         */
        if (segment_eq(get_fs(), KERNEL_DS))
                return;
-
-       /*
-        * it would be nicer only to annotate paths which are not under
-        * pagefault_disable, however that requires a larger audit and
-        * providing helpers like get_user_atomic.
-        */
-       if (in_atomic())
+       if (pagefault_disabled())
                return;
-
-       __might_sleep(__FILE__, __LINE__, 0);
-
+       __might_sleep(file, line, 0);
+#if defined(CONFIG_DEBUG_ATOMIC_SLEEP)
        if (current->mm)
                might_lock_read(&current->mm->mmap_sem);
+#endif
 }
-EXPORT_SYMBOL(might_fault);
+EXPORT_SYMBOL(__might_fault);
 #endif
 
 #if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS)