Re: [patch] sched: minimalist select_idle_sibling() bouncing cow syndrome fix
On Mon, 2013-01-28 at 12:21 +0100, Ingo Molnar wrote: > * Mike Galbraith wrote: > > > On Mon, 2013-01-28 at 11:53 +0100, Ingo Molnar wrote: > > > * Mike Galbraith wrote: > > > > > > > If the previous CPU is cache affine and idle, select it. > > > > > > No objections in principle - but would be nice to have a > > > changelog with numbers, % of improvement included and so? > > > > Well, that like was my changelog, guess it needs improvement. > > > > Take 2. > > > > sched: minimalist select_idle_sibling() bouncing cow syndrome fix > > > > If the previous CPU is cache affine and idle, select it. > > > > The current implementation simply traverses the sd_llc domain, > > taking the first idle CPU encountered, which walks buddy pairs > > hand in hand over the package, inflicting excruciating pain. > > > > 1 tbench pair (worst case) in a 10 core + SMT package: > > > > pre 15.22 MB/sec 1 procs > > post 252.01 MB/sec 1 procs > > Drool ... :-) Yeah, it really is _that_ fugly as is. > What would be a 'contrarian' test - i.e. a test where this could > hurt most? There is none. It cuts off no preemption escape routes for pgbench, still has both good and evil faces for all to see, and some to turn to stone ;-) It only does one thing, don't do the unspeakable. -Mike -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] sched: minimalist select_idle_sibling() bouncing cow syndrome fix
* Mike Galbraith wrote: > On Mon, 2013-01-28 at 11:53 +0100, Ingo Molnar wrote: > > * Mike Galbraith wrote: > > > > > If the previous CPU is cache affine and idle, select it. > > > > No objections in principle - but would be nice to have a > > changelog with numbers, % of improvement included and so? > > Well, that like was my changelog, guess it needs improvement. > > Take 2. > > sched: minimalist select_idle_sibling() bouncing cow syndrome fix > > If the previous CPU is cache affine and idle, select it. > > The current implementation simply traverses the sd_llc domain, > taking the first idle CPU encountered, which walks buddy pairs > hand in hand over the package, inflicting excruciating pain. > > 1 tbench pair (worst case) in a 10 core + SMT package: > > pre 15.22 MB/sec 1 procs > post 252.01 MB/sec 1 procs Drool ... :-) What would be a 'contrarian' test - i.e. a test where this could hurt most? Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] sched: minimalist select_idle_sibling() bouncing cow syndrome fix
On Mon, 2013-01-28 at 11:53 +0100, Ingo Molnar wrote: > * Mike Galbraith wrote: > > > If the previous CPU is cache affine and idle, select it. > > No objections in principle - but would be nice to have a > changelog with numbers, % of improvement included and so? Well, that like was my changelog, guess it needs improvement. Take 2. sched: minimalist select_idle_sibling() bouncing cow syndrome fix If the previous CPU is cache affine and idle, select it. The current implementation simply traverses the sd_llc domain, taking the first idle CPU encountered, which walks buddy pairs hand in hand over the package, inflicting excruciating pain. 1 tbench pair (worst case) in a 10 core + SMT package: pre 15.22 MB/sec 1 procs post 252.01 MB/sec 1 procs Signed-off-by: Mike Galbraith --- kernel/sched/fair.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3270,25 +3270,18 @@ find_idlest_cpu(struct sched_group *grou */ static int select_idle_sibling(struct task_struct *p, int target) { - int cpu = smp_processor_id(); - int prev_cpu = task_cpu(p); struct sched_domain *sd; struct sched_group *sg; - int i; + int i = task_cpu(p); - /* -* If the task is going to be woken-up on this cpu and if it is -* already idle, then it is the right target. -*/ - if (target == cpu && idle_cpu(cpu)) - return cpu; + if (idle_cpu(target)) + return target; /* -* If the task is going to be woken-up on the cpu where it previously -* ran and if it is currently idle, then it the right target. +* If the prevous cpu is cache affine and idle, don't be stupid. */ - if (target == prev_cpu && idle_cpu(prev_cpu)) - return prev_cpu; + if (i != target && cpus_share_cache(i, target) && idle_cpu(i)) + return i; /* * Otherwise, iterate the domains and find an elegible idle cpu. @@ -3302,7 +3295,7 @@ static int select_idle_sibling(struct ta goto next; for_each_cpu(i, sched_group_cpus(sg)) { - if (!idle_cpu(i)) + if (i == target || !idle_cpu(i)) goto next; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] sched: minimalist select_idle_sibling() bouncing cow syndrome fix
* Mike Galbraith wrote: > If the previous CPU is cache affine and idle, select it. No objections in principle - but would be nice to have a changelog with numbers, % of improvement included and so? Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] sched: minimalist select_idle_sibling() bouncing cow syndrome fix
* Mike Galbraith bitbuc...@online.de wrote: If the previous CPU is cache affine and idle, select it. No objections in principle - but would be nice to have a changelog with numbers, % of improvement included and so? Thanks, Ingo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] sched: minimalist select_idle_sibling() bouncing cow syndrome fix
On Mon, 2013-01-28 at 11:53 +0100, Ingo Molnar wrote: * Mike Galbraith bitbuc...@online.de wrote: If the previous CPU is cache affine and idle, select it. No objections in principle - but would be nice to have a changelog with numbers, % of improvement included and so? Well, that like was my changelog, guess it needs improvement. Take 2. sched: minimalist select_idle_sibling() bouncing cow syndrome fix If the previous CPU is cache affine and idle, select it. The current implementation simply traverses the sd_llc domain, taking the first idle CPU encountered, which walks buddy pairs hand in hand over the package, inflicting excruciating pain. 1 tbench pair (worst case) in a 10 core + SMT package: pre 15.22 MB/sec 1 procs post 252.01 MB/sec 1 procs Signed-off-by: Mike Galbraith bitbuc...@online.de --- kernel/sched/fair.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3270,25 +3270,18 @@ find_idlest_cpu(struct sched_group *grou */ static int select_idle_sibling(struct task_struct *p, int target) { - int cpu = smp_processor_id(); - int prev_cpu = task_cpu(p); struct sched_domain *sd; struct sched_group *sg; - int i; + int i = task_cpu(p); - /* -* If the task is going to be woken-up on this cpu and if it is -* already idle, then it is the right target. -*/ - if (target == cpu idle_cpu(cpu)) - return cpu; + if (idle_cpu(target)) + return target; /* -* If the task is going to be woken-up on the cpu where it previously -* ran and if it is currently idle, then it the right target. +* If the prevous cpu is cache affine and idle, don't be stupid. */ - if (target == prev_cpu idle_cpu(prev_cpu)) - return prev_cpu; + if (i != target cpus_share_cache(i, target) idle_cpu(i)) + return i; /* * Otherwise, iterate the domains and find an elegible idle cpu. @@ -3302,7 +3295,7 @@ static int select_idle_sibling(struct ta goto next; for_each_cpu(i, sched_group_cpus(sg)) { - if (!idle_cpu(i)) + if (i == target || !idle_cpu(i)) goto next; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] sched: minimalist select_idle_sibling() bouncing cow syndrome fix
* Mike Galbraith bitbuc...@online.de wrote: On Mon, 2013-01-28 at 11:53 +0100, Ingo Molnar wrote: * Mike Galbraith bitbuc...@online.de wrote: If the previous CPU is cache affine and idle, select it. No objections in principle - but would be nice to have a changelog with numbers, % of improvement included and so? Well, that like was my changelog, guess it needs improvement. Take 2. sched: minimalist select_idle_sibling() bouncing cow syndrome fix If the previous CPU is cache affine and idle, select it. The current implementation simply traverses the sd_llc domain, taking the first idle CPU encountered, which walks buddy pairs hand in hand over the package, inflicting excruciating pain. 1 tbench pair (worst case) in a 10 core + SMT package: pre 15.22 MB/sec 1 procs post 252.01 MB/sec 1 procs Drool ... :-) What would be a 'contrarian' test - i.e. a test where this could hurt most? Thanks, Ingo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [patch] sched: minimalist select_idle_sibling() bouncing cow syndrome fix
On Mon, 2013-01-28 at 12:21 +0100, Ingo Molnar wrote: * Mike Galbraith bitbuc...@online.de wrote: On Mon, 2013-01-28 at 11:53 +0100, Ingo Molnar wrote: * Mike Galbraith bitbuc...@online.de wrote: If the previous CPU is cache affine and idle, select it. No objections in principle - but would be nice to have a changelog with numbers, % of improvement included and so? Well, that like was my changelog, guess it needs improvement. Take 2. sched: minimalist select_idle_sibling() bouncing cow syndrome fix If the previous CPU is cache affine and idle, select it. The current implementation simply traverses the sd_llc domain, taking the first idle CPU encountered, which walks buddy pairs hand in hand over the package, inflicting excruciating pain. 1 tbench pair (worst case) in a 10 core + SMT package: pre 15.22 MB/sec 1 procs post 252.01 MB/sec 1 procs Drool ... :-) Yeah, it really is _that_ fugly as is. What would be a 'contrarian' test - i.e. a test where this could hurt most? There is none. It cuts off no preemption escape routes for pgbench, still has both good and evil faces for all to see, and some to turn to stone ;-) It only does one thing, don't do the unspeakable. -Mike -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch] sched: minimalist select_idle_sibling() bouncing cow syndrome fix
If the previous CPU is cache affine and idle, select it. Signed-off-by: Mike Galbraith --- kernel/sched/fair.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3270,25 +3270,18 @@ find_idlest_cpu(struct sched_group *grou */ static int select_idle_sibling(struct task_struct *p, int target) { - int cpu = smp_processor_id(); - int prev_cpu = task_cpu(p); struct sched_domain *sd; struct sched_group *sg; - int i; + int i = task_cpu(p); - /* -* If the task is going to be woken-up on this cpu and if it is -* already idle, then it is the right target. -*/ - if (target == cpu && idle_cpu(cpu)) - return cpu; + if (idle_cpu(target)) + return target; /* -* If the task is going to be woken-up on the cpu where it previously -* ran and if it is currently idle, then it the right target. +* If the prevous cpu is cache affine and idle, don't be stupid. */ - if (target == prev_cpu && idle_cpu(prev_cpu)) - return prev_cpu; + if (i != target && cpus_share_cache(i, target) && idle_cpu(i)) + return i; /* * Otherwise, iterate the domains and find an elegible idle cpu. @@ -3302,7 +3295,7 @@ static int select_idle_sibling(struct ta goto next; for_each_cpu(i, sched_group_cpus(sg)) { - if (!idle_cpu(i)) + if (i == target || !idle_cpu(i)) goto next; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[patch] sched: minimalist select_idle_sibling() bouncing cow syndrome fix
If the previous CPU is cache affine and idle, select it. Signed-off-by: Mike Galbraith bitbuc...@online.de --- kernel/sched/fair.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3270,25 +3270,18 @@ find_idlest_cpu(struct sched_group *grou */ static int select_idle_sibling(struct task_struct *p, int target) { - int cpu = smp_processor_id(); - int prev_cpu = task_cpu(p); struct sched_domain *sd; struct sched_group *sg; - int i; + int i = task_cpu(p); - /* -* If the task is going to be woken-up on this cpu and if it is -* already idle, then it is the right target. -*/ - if (target == cpu idle_cpu(cpu)) - return cpu; + if (idle_cpu(target)) + return target; /* -* If the task is going to be woken-up on the cpu where it previously -* ran and if it is currently idle, then it the right target. +* If the prevous cpu is cache affine and idle, don't be stupid. */ - if (target == prev_cpu idle_cpu(prev_cpu)) - return prev_cpu; + if (i != target cpus_share_cache(i, target) idle_cpu(i)) + return i; /* * Otherwise, iterate the domains and find an elegible idle cpu. @@ -3302,7 +3295,7 @@ static int select_idle_sibling(struct ta goto next; for_each_cpu(i, sched_group_cpus(sg)) { - if (!idle_cpu(i)) + if (i == target || !idle_cpu(i)) goto next; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/