• Mel Gorman's avatar
    futex: Remove requirement for lock_page() in get_futex_key() · 714f4e55
    Mel Gorman authored
    commit 65d8fc77 upstream.
    
    When dealing with key handling for shared futexes, we can drastically reduce
    the usage/need of the page lock. 1) For anonymous pages, the associated futex
    object is the mm_struct which does not require the page lock. 2) For inode
    based, keys, we can check under RCU read lock if the page mapping is still
    valid and take reference to the inode. This just leaves one rare race that
    requires the page lock in the slow path when examining the swapcache.
    
    Additionally realtime users currently have a problem with the page lock being
    contended for unbounded periods of time during futex operations.
    
    Task A
         get_futex_key()
         lock_page()
        ---> preempted
    
    Now any other task trying to lock that page will have to wait until
    task A gets scheduled back in, which is an unbound time.
    
    With this patch, we pretty much have a lockless futex_get_key().
    
    Experiments show that this patch can boost/speed...
    714f4e55
futex.c 85 KB