Re: [PATCH] kthread: Don't depend on work queues

From: Eric W. Biederman
Date: Wed Apr 11 2007 - 14:24:54 EST


Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> writes:

> argh. Your description freely confuddles the terms "kernel thread" and
> "kthread". Can we not do that? Henceforth the term "kernel thread" refers
> to something which was started with kernel_thread() and "kthread" refers to
> something which was created by kthread_create(), OK?

Yes. Will fix.

> Your patch gets midly tangled up with Oleg's recent
>
> reduce-reparent_to_init.patch
> make-kernel-threads-invisible-to-sbin-init.patch
> reparent-kernel-threads-to-swapper.patch
>
> but they seemed fairly unpopular anyway so I'll drop 'em.

Ok. I kind of liked the first one but that is a minor cleanup.

> Your wait_event() will contribute to load average, I expect. We get mail.
> I converted it to wait_event_interruptible().

Ok. That is more polite.

> I guess using PF_NOFREEZE rather than try_to_freeze() is OK, but one
> wonders what thinking led to that?

That is what we are currently doing for the work queues, and I was lazy.
For people who care they can fix it.

> Often when we have a singleton thread like this it is neater to use
> wake_up_process() directly on it, rather than creating a rather pointless
> waitqueue_head for it. I started looking into that but it would have taken
> more than 30 seconds.

Sure I took a look and it isn't too hard. Updated patch in a minute...

I have left the locking the way it is despite the reasonable chance that
Oleg points I can only acquire the lock when deleting the list entry.
I'm to lazy to think through the SMP races to make certain that is safe.

Eric




-
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/