The patch titled sched: use tasklet to call balancing has been added to the -mm tree. Its filename is sched-use-tasklet-to-call-balancing.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: sched: use tasklet to call balancing From: Christoph Lameter <clameter@xxxxxxx> Call rebalance_tick (renamed to rebalance_domains) from a tasklet. We calculate the earliest time for each layer of sched domains to be rescanned (this is the rescan time for idle) and use the earliest of those to schedule the tasklet again via a new field "next_balance" added to struct rq. Signed-off-by: Christoph Lameter <clameter@xxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Cc: Nick Piggin <nickpiggin@xxxxxxxxxxxx> Cc: "Siddha, Suresh B" <suresh.b.siddha@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- kernel/sched.c | 19 +++++++++++++++---- 1 files changed, 15 insertions(+), 4 deletions(-) diff -puN kernel/sched.c~sched-use-tasklet-to-call-balancing kernel/sched.c --- a/kernel/sched.c~sched-use-tasklet-to-call-balancing +++ a/kernel/sched.c @@ -227,6 +227,7 @@ struct rq { unsigned long expired_timestamp; unsigned long long timestamp_last_tick; struct task_struct *curr, *idle; + unsigned long next_balance; struct mm_struct *prev_mm; struct prio_array *active, *expired, arrays[2]; int best_expired_prio; @@ -2841,16 +2842,18 @@ static void update_load(struct rq *this_ } /* - * rebalance_tick will get called every timer tick, on every CPU. + * rebalance_domains is triggered when needed via a tasklet from the + * scheduler tick. * * It checks each scheduling domain to see if it is due to be balanced, * and initiates a balancing operation if so. * * Balancing parameters are set up in arch_init_sched_domains. */ -static void -rebalance_tick(int this_cpu, struct rq *this_rq) +static void rebalance_domains(unsigned long dummy) { + int this_cpu = smp_processor_id(); + struct rq *this_rq = cpu_rq(this_cpu); unsigned long interval; struct sched_domain *sd; /* @@ -2859,6 +2862,8 @@ rebalance_tick(int this_cpu, struct rq * */ enum idle_type idle = !this_rq->nr_running ? SCHED_IDLE : NOT_IDLE; + /* Earliest time when we have to call rebalance_domains again */ + unsigned long next_balance = jiffies + 60*HZ; for_each_domain(this_cpu, sd) { if (!(sd->flags & SD_LOAD_BALANCE)) @@ -2884,8 +2889,13 @@ rebalance_tick(int this_cpu, struct rq * } sd->last_balance += interval; } + next_balance = min(next_balance, + sd->last_balance + sd->balance_interval); } + this_rq->next_balance = next_balance; } + +DECLARE_TASKLET(rebalance, &rebalance_domains, 0L); #else /* * on UP we do not need to balance between CPUs: @@ -3137,7 +3147,8 @@ void scheduler_tick(void) task_running_tick(rq, p); #ifdef CONFIG_SMP update_load(rq); - rebalance_tick(cpu, rq); + if (jiffies >= rq->next_balance) + tasklet_schedule(&rebalance); #endif } _ Patches currently in -mm which might be from clameter@xxxxxxx are create-compat_sys_migrate_pages.patch wire-up-sys_migrate_pages.patch memory-page-alloc-minor-cleanups.patch memory-page-alloc-minor-cleanups-fix.patch get-rid-of-zone_table.patch deal-with-cases-of-zone_dma-meaning-the-first-zone.patch get-rid-of-zone_table-fix-3.patch introduce-config_zone_dma.patch optional-zone_dma-in-the-vm.patch optional-zone_dma-in-the-vm-no-gfp_dma-check-in-the-slab-if-no-config_zone_dma-is-set.patch optional-zone_dma-in-the-vm-no-gfp_dma-check-in-the-slab-if-no-config_zone_dma-is-set-reduce-config_zone_dma-ifdefs.patch optional-zone_dma-for-ia64.patch remove-zone_dma-remains-from-parisc.patch remove-zone_dma-remains-from-sh-sh64.patch set-config_zone_dma-for-arches-with-generic_isa_dma.patch zoneid-fix-up-calculations-for-zoneid_pgshift.patch radix-tree-rcu-lockless-readside.patch sched-avoid-taking-rq-lock-in-wake_priority_sleeper.patch sched-disable-interrupts-for-locking-in-load_balance.patch sched-extract-load-calculation-from-rebalance_tick.patch sched-stagger-load-balancing-in-build_sched_domains.patch sched-move-idle-stat-calculation-into-rebalance_tick.patch sched-use-tasklet-to-call-balancing.patch sched-call-tasklet-less-frequently.patch zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable-swap_prefetch.patch reduce-max_nr_zones-swap_prefetch-remove-incorrect-use-of-zone_highmem.patch numa-add-zone_to_nid-function-swap_prefetch.patch readahead-state-based-method-aging-accounting.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html