• Ingo Molnar's avatar
    [PATCH] timer-2.5.40-F7 · afc14106
    Ingo Molnar authored
    This does a number of timer subsystem enhancements:
    
    - simplified timer initialization, now it's the cheapest possible thing:
    
        static inline void init_timer(struct timer_list * timer)
        {
                timer->base = NULL;
        }
    
      since the timer functions already did a !timer->base check this did not
      have any effect on their fastpath.
    
    - the rule from now on is that timer->base is set upon activation of the
      timer, and cleared upon deactivation. This also made it possible to:
    
    - reorganize all the timer handling code to not assume anything about
      timer->entry.next and timer->entry.prev - this also removed lots of
      unnecessery cleaning of these fields. Removed lots of unnecessary list
      operations from the fastpath.
    
    - simplified del_timer_sync(): it now uses del_timer() plus some simple
      synchronization code. Note that this also fixes a bug: if mod_timer (or
      add_timer) moves a currently executing timer to another CPU's timer
      vector, then del_timer_sync() does not synchronize with the handler
      properly.
    
    - bugfix: moved run_local_timers() from scheduler_tick() into
      update_process_times() .. scheduler_tick() might be called from the fork
      code which will not quite have the intended effect ...
    
    - removed the APIC-timer-IRQ shifting done on SMP, Dipankar Sarma's
      testing shows no negative effects.
    
    - cleaned up include/linux/timer.h:
    
         - removed the timer_t typedef, and fixes up kernel/workqueue.c to use
           the 'struct timer_list' name instead.
    
         - removed unnecessery includes
    
         - renamed the 'list' field to 'entry' (it's an entry not a list head)
    
         - exchanged the 'function' and 'data' fields. This, besides being
           more logical, also unearthed the last few remaining places that
           initialized timers by assuming some given field ordering, the patch
           also fixes these places. (fs/xfs/pagebuf/page_buf.c,
           net/core/profile.c and net/ipv4/inetpeer.c)
    
         - removed the defunct sync_timers(), timer_enter() and timer_exit()
           prototypes.
    
         - added docbook-style comments.
    
    - other kernel/timer.c changes:
    
         - base->running_timer does not have to be volatile ...
    
         - added consistent comments to all the important functions.
    
         - made the sync-waiting in del_timer_sync preempt- and lowpower-
           friendly.
    
    i've compiled, booted & tested the patched kernel on x86 UP and SMP. I
    have tried moderately high networking load as well, to make sure the timer
    changes are correct - they appear to be.
    afc14106
profile.c 6.34 KB