• M
    mm, sched: Allow uaccess in atomic with pagefault_disable() · 662bbcb2
    Michael S. Tsirkin 提交于
    This changes might_fault() so that it does not
    trigger a false positive diagnostic for e.g. the following
    sequence:
    
    	spin_lock_irqsave()
    	pagefault_disable()
    	copy_to_user()
    	pagefault_enable()
    	spin_unlock_irqrestore()
    
    In particular vhost wants to do this, to call
    socket ops from under a lock.
    
    There are 3 cases to consider:
    
     - CONFIG_PROVE_LOCKING - might_fault is non-inline
       so it's easy to move the in_atomic test to fix
       up the false positive warning.
    
     - CONFIG_DEBUG_ATOMIC_SLEEP - might_fault
       is currently inline, but we are calling a
       non-inline __might_sleep anyway,
       so let's use the non-line version of might_fault
       that does the right thing.
    
     - !CONFIG_DEBUG_ATOMIC_SLEEP && !CONFIG_PROVE_LOCKING
       __might_sleep is a nop so might_fault is a nop.
    
    Make this explicit.
    Signed-off-by: NMichael S. Tsirkin <mst@redhat.com>
    Signed-off-by: NPeter Zijlstra <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: http://lkml.kernel.org/r/1369577426-26721-11-git-send-email-mst@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
    662bbcb2
memory.c 116.0 KB