[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120613185748.GF2427@linux.vnet.ibm.com>
Date: Wed, 13 Jun 2012 11:57:48 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>,
"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
Rusty Russell <rusty@...tcorp.com.au>,
Tejun Heo <tj@...nel.org>
Subject: Re: [RFC patch 2/5] smpboot: Provide infrastructure for percpu
hotplug threads
On Wed, Jun 13, 2012 at 11:00:54AM -0000, Thomas Gleixner wrote:
> Provide a generic interface for setting up and tearing down percpu
> threads.
>
> On registration the threads for already online cpus are created and
> started. On deregistration (modules) the threads are stoppped.
>
> During hotplug operations the threads are created, started, parked and
> unparked. The datastructure for registration provides a pointer to
> percpu storage space and optional setup, cleanup, park, unpark
> functions. These functions are called when the thread state changes.
>
> Thread functions should look like the following:
>
> int thread_fn(void *cookie)
> {
> while (!smpboot_thread_check_parking(cookie)) {
> do_stuff();
> }
> return 0;
> }
>
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
[ . . . ]
> Index: tip/kernel/cpu.c
> ===================================================================
> --- tip.orig/kernel/cpu.c
> +++ tip/kernel/cpu.c
> @@ -280,6 +280,7 @@ static int __ref _cpu_down(unsigned int
> __func__, cpu);
> goto out_release;
> }
> + smpboot_park_threads(cpu);
>
> err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu));
> if (err) {
> @@ -354,6 +355,10 @@ static int __cpuinit _cpu_up(unsigned in
> goto out;
> }
>
> + ret = smpboot_create_threads(cpu);
> + if (ret)
> + goto out;
> +
> ret = __cpu_notify(CPU_UP_PREPARE | mod, hcpu, -1, &nr_calls);
> if (ret) {
> nr_calls--;
> @@ -370,6 +375,7 @@ static int __cpuinit _cpu_up(unsigned in
>
> /* Now call notifier in preparation. */
> cpu_notify(CPU_ONLINE | mod, hcpu);
> + smpboot_unpark_threads(cpu);
OK, RCU must use the lower-level interfaces, given that one of
then CPU_ONLINE notifiers might invoke synchronize_rcu().
Thanx, Paul
--
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