* [PATCH] mm: fix vmstat_update to keep scheduling itself on all cores
@ 2012-03-14 6:52 Gilad Ben-Yossef
2012-03-14 14:09 ` Christoph Lameter
0 siblings, 1 reply; 3+ messages in thread
From: Gilad Ben-Yossef @ 2012-03-14 6:52 UTC (permalink / raw)
To: linux-kernel
Cc: Andrew Morton, Mel Gorman, Christoph Lameter, KAMEZAWA Hiroyuki,
Andi Kleen, Linux-MM
We set up per-cpu work structures for vmstat and schedule them on
each cpu when they go online only to re-schedule them on the general
work queue when they first run.
This doesn't seem right - how do we ever guarantee that vmstat_update runs
on all cpus? Either I've missed something or our vm stats are off and per-cpu
pages are not drained as frequently as we think they are.
Fix it by re-scheduling the work item on the same cpu it first ran on.
Tested on x86 on 8 way SMP VM.
Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Mel Gorman <mel@csn.ul.ie>
CC: Christoph Lameter <cl@linux.com>
CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
CC: Andi Kleen <ak@linux.intel.com>
CC: linux-mm@kvack.org
---
diff --git a/mm/vmstat.c b/mm/vmstat.c
index f600557..b396044 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1144,8 +1144,10 @@ int sysctl_stat_interval __read_mostly = HZ;
static void vmstat_update(struct work_struct *w)
{
- refresh_cpu_vm_stats(smp_processor_id());
- schedule_delayed_work(&__get_cpu_var(vmstat_work),
+ int cpu = smp_processor_id();
+
+ refresh_cpu_vm_stats(cpu);
+ schedule_delayed_work_on(cpu, &__get_cpu_var(vmstat_work),
round_jiffies_relative(sysctl_stat_interval));
}
--
Gilad Ben-Yossef
Chief Coffee Drinker
gilad@benyossef.com
Israel Cell: +972-52-8260388
US Cell: +1-973-8260388
http://benyossef.com
"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
-- Jean-Baptiste Queru
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: fix vmstat_update to keep scheduling itself on all cores
2012-03-14 6:52 [PATCH] mm: fix vmstat_update to keep scheduling itself on all cores Gilad Ben-Yossef
@ 2012-03-14 14:09 ` Christoph Lameter
2012-03-14 14:51 ` Gilad Ben-Yossef
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Lameter @ 2012-03-14 14:09 UTC (permalink / raw)
To: Gilad Ben-Yossef
Cc: linux-kernel, Andrew Morton, Mel Gorman, KAMEZAWA Hiroyuki,
Andi Kleen, Linux-MM
On Wed, 14 Mar 2012, Gilad Ben-Yossef wrote:
> We set up per-cpu work structures for vmstat and schedule them on
> each cpu when they go online only to re-schedule them on the general
> work queue when they first run.
schedule_delayed_work queues on the current cpu unless the
WQ_UNBOUND flag is set. Which is not set for vmstat_work.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: fix vmstat_update to keep scheduling itself on all cores
2012-03-14 14:09 ` Christoph Lameter
@ 2012-03-14 14:51 ` Gilad Ben-Yossef
0 siblings, 0 replies; 3+ messages in thread
From: Gilad Ben-Yossef @ 2012-03-14 14:51 UTC (permalink / raw)
To: Christoph Lameter
Cc: linux-kernel, Andrew Morton, Mel Gorman, KAMEZAWA Hiroyuki,
Andi Kleen, Linux-MM
On Wed, Mar 14, 2012 at 4:09 PM, Christoph Lameter <cl@linux.com> wrote:
> On Wed, 14 Mar 2012, Gilad Ben-Yossef wrote:
>
>> We set up per-cpu work structures for vmstat and schedule them on
>> each cpu when they go online only to re-schedule them on the general
>> work queue when they first run.
>
> schedule_delayed_work queues on the current cpu unless the
> WQ_UNBOUND flag is set. Which is not set for vmstat_work.
I've missed that. My bad. Sorry for the noise.
Gilad
--
Gilad Ben-Yossef
Chief Coffee Drinker
gilad@benyossef.com
Israel Cell: +972-52-8260388
US Cell: +1-973-8260388
http://benyossef.com
"If you take a class in large-scale robotics, can you end up in a
situation where the homework eats your dog?"
-- Jean-Baptiste Queru
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-14 14:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-14 6:52 [PATCH] mm: fix vmstat_update to keep scheduling itself on all cores Gilad Ben-Yossef
2012-03-14 14:09 ` Christoph Lameter
2012-03-14 14:51 ` Gilad Ben-Yossef
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox