]> Pileus Git - ~andy/linux/blobdiff - mm/memory.c
mm, sched: Allow uaccess in atomic with pagefault_disable()
[~andy/linux] / mm / memory.c
index 6dc1882fbd725c61badb4fd072418c7330001ce1..d7d54a11477372b605b34af65c233f206a7bd982 100644 (file)
@@ -4210,7 +4210,7 @@ void print_vma_addr(char *prefix, unsigned long ip)
        up_read(&mm->mmap_sem);
 }
 
-#ifdef CONFIG_PROVE_LOCKING
+#if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_DEBUG_ATOMIC_SLEEP)
 void might_fault(void)
 {
        /*
@@ -4222,13 +4222,17 @@ void might_fault(void)
        if (segment_eq(get_fs(), KERNEL_DS))
                return;
 
-       might_sleep();
        /*
         * 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() && current->mm)
+       if (in_atomic())
+               return;
+
+       __might_sleep(__FILE__, __LINE__, 0);
+
+       if (current->mm)
                might_lock_read(&current->mm->mmap_sem);
 }
 EXPORT_SYMBOL(might_fault);