Re: [RFC patch 1/5] kthread: Implement park/unpark facility

From: Tejun Heo
Date: Thu Jun 14 2012 - 21:44:38 EST


On Thu, Jun 14, 2012 at 03:13:31PM -0700, Silas Boyd-Wickizer wrote:
> Hello,
>
> Attached is a rough patch that uses park/unpark for workqueue idle
> threads. The patch is a hack, it probably has bugs, and it certainly
> doesn't simplify the workqueue code. Perhaps, however, the patch
> might be useful in guiding future changes to smp_boot_threads or
> workqueues.
>
> A difficulty in applying park/unpark (or smp_boot_threads
> potentially), it that there is no single per-CPU thread for each CPU.
> That is, the thread that starts out as the initial worker/idle thread
> could be different from any thread that is idling when a CPU goes
> offline. An additional complication is that a per-cpu worker that is
> idle may have initially been unbound (e.g. worker creation in the
> trustee_thread can cause this).

I haven't looked at it in any detail yet but if the goal is just
keeping workers around for temporarily down CPUs, workqueue changes
can be pretty simple. I *think* all that's necessary is trustee not
butchering on cpu down. wq already has mechanisms to recycle dangling
workers when a cpu comes back online. I'll give it a shot next week.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/