• Ingo Molnar's avatar
    [PATCH] futex-2.5.40-B5 · 6a20c6fe
    Ingo Molnar authored
    This does a number of futex bugfixes, performance improvements and
    cleanups.
    
    The bugfixes are:
    
     - fix locking bug noticed by Martin Wirth: the ordering of
       page_table_lock, vcache_lock and futex_lock was inconsistent and
       created the possibility of an SMP deadlock.
    
     - fix spurious wakeup noticed by Andrew Morton: the get_user() in
       futex_wait() can set the task state to TASK_RUNNING.
    
     - fix futex_wake COW race, noticed by Martin Wirth - futex_wake() has to
       go through the same lookup rules as the futex_wait() code, otherwise it
       might end up trying to wake up based on the wrong physical page.
    
    Improvements:
    
     - speed up the basic addrs => page lookup done by the futex code. It used
       to do an unconditional get_user_pages() call, which did a vma lookup
       and other heavy-handed tactics - while the common case is that the
       page is mapped and available. Furthermore, due to the COW-race code we
       had to re-check the mapping anyway, which made the get_user_pages()
       thing pretty unnecessery. This inefficiency was noticed by Martin
       Wirth.
    
       the new lookup code first does a lightweight follow_page(), then if no
       page is present we do the get_user_pages() thing.
    
     - locking cleanups - the new lookup code made some things simpler, eg.
       the hash calculation can now be done in queue_me().
    
     - added comments
    
     - reduced include file use.
    
     - increased the futex hashtable.
    6a20c6fe
futex.c 10.6 KB