• Christoph Lameter's avatar
    [PATCH] sched: call tasklet less frequently · 1bd77f2d
    Christoph Lameter authored
    Trigger softirq less frequently
    
    We trigger the softirq before this patch using offset of sd->interval.
    However, if the queue is busy then it is sufficient to schedule the softirq
    with sd->interval * busy_factor.
    
    So we modify the calculation of the next time to balance by taking
    the interval added to last_balance again. This is only the
    right value if the idle/busy situation continues as is.
    
    There are two potential trouble spots:
    - If the queue was idle and now gets busy then we call rebalance
      early. However, that is not a problem because we will then use
      the longer interval for the next period.
    
    - If the queue was busy and becomes idle then we potentially
      wait too long before rebalancing. However, when the task
      goes idle then idle_balance is called. We add another calculation
      of the next balance time based on sd->interval in idle_balance
      so that we will rebalance soon.
    
    V2->V3:
    - Calculate rebalance time based on current jiffies and not
      based on the jiffies at the last time we load balanced.
      We no longer rely on staggering and therefore we can
      affort to do this now.
    
    V3->V4:
    - Use functions to do jiffy comparisons.
    Signed-off-by: default avatarChristoph Lameter <clameter@sgi.com>
    Cc: Peter Williams <pwil3058@bigpond.net.au>
    Cc: Nick Piggin <nickpiggin@yahoo.com.au>
    Cc: Christoph Lameter <clameter@sgi.com>
    Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
    Cc: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
    Acked-by: default avatarIngo Molnar <mingo@elte.hu>
    Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    1bd77f2d
sched.c 176 KB