]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] sched: filter affine wakeups
authorakpm@osdl.org <akpm@osdl.org>
Thu, 12 Jan 2006 09:05:32 +0000 (01:05 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 12 Jan 2006 17:08:50 +0000 (09:08 -0800)
\r)

From: Nick Piggin <nickpiggin@yahoo.com.au>

Track the last waker CPU, and only consider wakeup-balancing if there's a
match between current waker CPU and the previous waker CPU.  This ensures
that there is some correlation between two subsequent wakeup events before
we move the task.  Should help random-wakeup workloads on large SMP
systems, by reducing the migration attempts by a factor of nr_cpus.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/sched.h
kernel/sched.c

index 5d6b9228bba930f2bbfd77fa633c7927b2e73d10..b5ef92a043a62394af8d043ec5bb14fe800d1c03 100644 (file)
@@ -696,8 +696,11 @@ struct task_struct {
 
        int lock_depth;         /* BKL lock depth */
 
-#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
+#if defined(CONFIG_SMP)
+       int last_waker_cpu;     /* CPU that last woke this task up */
+#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
        int oncpu;
+#endif
 #endif
        int prio, static_prio;
        struct list_head run_list;
index 98461de1ab651e642d81a69b8bac4850454b6e4f..c9dec2aa19760c9dd54905556181692054ade31e 100644 (file)
@@ -1290,6 +1290,9 @@ static int try_to_wake_up(task_t *p, unsigned int state, int sync)
                }
        }
 
+       if (p->last_waker_cpu != this_cpu)
+               goto out_set_cpu;
+
        if (unlikely(!cpu_isset(this_cpu, p->cpus_allowed)))
                goto out_set_cpu;
 
@@ -1360,6 +1363,8 @@ out_set_cpu:
                cpu = task_cpu(p);
        }
 
+       p->last_waker_cpu = this_cpu;
+
 out_activate:
 #endif /* CONFIG_SMP */
        if (old_state == TASK_UNINTERRUPTIBLE) {
@@ -1441,9 +1446,12 @@ void fastcall sched_fork(task_t *p, int clone_flags)
 #ifdef CONFIG_SCHEDSTATS
        memset(&p->sched_info, 0, sizeof(p->sched_info));
 #endif
-#if defined(CONFIG_SMP) && defined(__ARCH_WANT_UNLOCKED_CTXSW)
+#if defined(CONFIG_SMP)
+       p->last_waker_cpu = cpu;
+#if defined(__ARCH_WANT_UNLOCKED_CTXSW)
        p->oncpu = 0;
 #endif
+#endif
 #ifdef CONFIG_PREEMPT
        /* Want to start with kernel preemption disabled. */
        task_thread_info(p)->preempt_count = 1;