Messages in this thread Patch in this message | | | Date | Wed, 6 Aug 2014 09:12:39 -0500 (CDT) | From | Christoph Lameter <> | Subject | Re: vmstat: On demand vmstat workers V8 |
| |
On Tue, 5 Aug 2014, Sasha Levin wrote:
> I can easily trigger it by cranking up the cpu hotplug code. Just try to > frequently offline and online cpus, it should reproduce quickly.
Thats what I thought.
The test was done with this fix applied right?
Subject: vmstat ondemand: Fix online/offline races
Do not allow onlining/offlining while the shepherd task is checking for vmstat threads.
On offlining a processor do the right thing cancelling the vmstat worker thread if it exista and also exclude it from the shepherd process checks.
Signed-off-by: Christoph Lameter <cl@linux.com>
Index: linux/mm/vmstat.c =================================================================== --- linux.orig/mm/vmstat.c 2014-07-30 09:35:54.602662306 -0500 +++ linux/mm/vmstat.c 2014-07-30 09:43:07.109037043 -0500 @@ -1317,6 +1317,7 @@ static void vmstat_shepherd(struct work_ { int cpu;
+ get_online_cpus(); /* Check processors whose vmstat worker threads have been disabled */ for_each_cpu(cpu, cpu_stat_off) if (need_update(cpu) && @@ -1325,6 +1326,7 @@ static void vmstat_shepherd(struct work_ schedule_delayed_work_on(cpu, &per_cpu(vmstat_work, cpu), __round_jiffies_relative(sysctl_stat_interval, cpu));
+ put_online_cpus();
schedule_delayed_work(&shepherd, round_jiffies_relative(sysctl_stat_interval)); @@ -1380,8 +1382,8 @@ static int vmstat_cpuup_callback(struct break; case CPU_DOWN_PREPARE: case CPU_DOWN_PREPARE_FROZEN: - if (!cpumask_test_and_set_cpu(cpu, cpu_stat_off)) - cancel_delayed_work_sync(&per_cpu(vmstat_work, cpu)); + cancel_delayed_work_sync(&per_cpu(vmstat_work, cpu)); + cpumask_clear_cpu(cpu, cpu_stat_off); break; case CPU_DOWN_FAILED: case CPU_DOWN_FAILED_FROZEN:
| |