• Andrew Morton's avatar
    [PATCH] Add del_single_shot_timer() · 1b9407d7
    Andrew Morton authored
    From: Geoff Gustafson <geoff@linux.jf.intel.com>,
          "Chen, Kenneth W" <kenneth.w.chen@intel.com>,
          Ingo Molnar <mingo@elte.hu>,
          me.
    
    The big-SMP guys are seeing high CPU load due to del_timer_sync()'s
    inefficiencies.  The callers are fs/aio.c and schedule_timeout().
    
    We note that neither of these callers' timer handlers actually re-add the
    timer - they are single-shot.
    
    So we don't need all that complexity in del_timer_sync() - we can just run
    del_timer() and if that worked we know the timer is dead.
    
    Add del_single_shot_timer(), export it to modules and use it in AIO and
    schedule_timeout().
    
    
    (these numbers are for an earlier patch, but they'll be close)
    
    Before:             32p     4p
         Warm cache   29,000    505
         Cold cache   37,800   1220
    
    After:              32p     4p
         Warm cache       95     88
         Cold cache    1,800    140
    
    [Measurements are CPU cycles spent in a call to del_timer_sync, the average
    of 1000 calls. 32p is 16-node NUMA, 4p is SMP.]
    
    (I cleaned up a few things and added some commentary)
    1b9407d7
timer.c 38.1 KB