Messages in this thread | | | From | Rusty Russell <> | Subject | Re: [PATCH/RFC 0/4] Add stop_machine_get/put_threads to stop_machine infrastructrue. | Date | Thu, 9 Oct 2008 11:18:27 +1100 |
| |
On Wednesday 08 October 2008 21:14:50 Heiko Carstens wrote: > On Wed, Oct 08, 2008 at 10:27:04AM +1000, Rusty Russell wrote: > > OK, idea #2. Let's just always have a kstopmachine thread running on > > every online cpu. Is there a sane way to reuse the workqueue threads for > > this? > > That's a very good idea and what the patch below does. It even simplifies > the stop_machine code and it does work on an otherwise idle system. > The only thing that needs to be addressed is that workqueue threads aka > stop_machine threads are no real time threads now. > We would need something like create_workqueue_prio() or > create_workqueue_rt(). Would that be acceptable?
Hmm, I was hoping to reuse the kevent threads rather than create YA set of threads. But hey, everyone else is doing it.
> +static struct workqueue_struct *stop_machine_wq; > +static struct work_struct *stop_machine_work; > +static struct stop_machine_data active, idle; > +static cpumask_t active_cpus;
Hmm, please make active cpus a const cpumask_t pointer. I'm trying to get rid of these kind of decls in another patch series :)
> /* This is the actual thread which stops the CPU. It exits by itself rather > * than waiting for kthread_stop(), because it's easier for hotplug CPU. */
This comment is no longer valid...
> +static int __init stop_machine_init(void) > +{ > + stop_machine_wq = create_workqueue("kstop"); > + stop_machine_work = kcalloc(NR_CPUS, sizeof(struct work_struct), > + GFP_KERNEL);
Perhaps make stop_machine_work a per-cpu array of struct work_struct instead of initializing it here. Or at least make it a percpu pointer and only alloc possible cpus.
Does it break cpu hotplug BTW? That's usually the problem.
But it looks nice! Rusty.
| |