[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140529235530.GA25555@localhost.localdomain>
Date: Fri, 30 May 2014 01:55:33 +0200
From: Frederic Weisbecker <fweisbec@...il.com>
To: Christoph Lameter <cl@...two.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Gilad Ben-Yossef <gilad@...yossef.com>,
Thomas Gleixner <tglx@...utronix.de>,
Tejun Heo <tj@...nel.org>, John Stultz <johnstul@...ibm.com>,
Hakan Akkan <hakanakkan@...il.com>,
Max Krasnyansky <maxk@...lcomm.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org, hughd@...gle.com,
viresh.kumar@...aro.org, hpa@...or.com, mingo@...nel.org,
peterz@...radead.org, Mike Frysinger <vapier@...too.org>,
Minchan Kim <minchan.kim@...il.com>
Subject: Re: [PATCH] vmstat: on demand updates from differentials V7
On Thu, May 29, 2014 at 02:56:15PM -0500, Christoph Lameter wrote:
> -static void start_cpu_timer(int cpu)
> +static void __init start_shepherd_timer(void)
> {
> - struct delayed_work *work = &per_cpu(vmstat_work, cpu);
> + int cpu;
> +
> + for_each_possible_cpu(cpu)
> + INIT_DEFERRABLE_WORK(per_cpu_ptr(&vmstat_work, cpu),
> + vmstat_update);
> +
> + cpu_stat_off = kmalloc(cpumask_size(), GFP_KERNEL);
Now you're open coding alloc_cpumask_var() ?
> + cpumask_copy(cpu_stat_off, cpu_online_mask);
>
> - INIT_DEFERRABLE_WORK(work, vmstat_update);
> - schedule_delayed_work_on(cpu, work, __round_jiffies_relative(HZ, cpu));
> + schedule_delayed_work(&shepherd,
> + round_jiffies_relative(sysctl_stat_interval));
> }
>
> static void vmstat_cpu_dead(int node)
> @@ -1266,17 +1367,17 @@
> case CPU_ONLINE:
> case CPU_ONLINE_FROZEN:
> refresh_zone_stat_thresholds();
> - start_cpu_timer(cpu);
> node_set_state(cpu_to_node(cpu), N_CPU);
> + cpumask_set_cpu(cpu, cpu_stat_off);
> break;
> case CPU_DOWN_PREPARE:
> case CPU_DOWN_PREPARE_FROZEN:
> - cancel_delayed_work_sync(&per_cpu(vmstat_work, cpu));
> - per_cpu(vmstat_work, cpu).work.func = NULL;
> + if (!cpumask_test_and_set_cpu(cpu, cpu_stat_off))
> + cancel_delayed_work_sync(&per_cpu(vmstat_work, cpu));
> break;
> case CPU_DOWN_FAILED:
> case CPU_DOWN_FAILED_FROZEN:
> - start_cpu_timer(cpu);
> + cpumask_set_cpu(cpu, cpu_stat_off);
> break;
> case CPU_DEAD:
> case CPU_DEAD_FROZEN:
> @@ -1296,15 +1397,10 @@
> static int __init setup_vmstat(void)
> {
> #ifdef CONFIG_SMP
> - int cpu;
> -
> cpu_notifier_register_begin();
> __register_cpu_notifier(&vmstat_notifier);
>
> - for_each_online_cpu(cpu) {
> - start_cpu_timer(cpu);
> - node_set_state(cpu_to_node(cpu), N_CPU);
> - }
> + start_shepherd_timer();
> cpu_notifier_register_done();
> #endif
> #ifdef CONFIG_PROC_FS
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists