Re: per-thread wait_queue_t
From: Linus Torvalds
Date: Sun Jun 08 2014 - 13:45:29 EST
On Sun, Jun 8, 2014 at 4:40 AM, Pavel Machek <pavel@xxxxxx> wrote:
>
> When you proposed to put wait queues into task_struct, you were
> probably looking for less coding and more analysis?
I'm ok with coding, I find your particular patch horrible.
You add a dynamic allocator that will work *horribly* badly if people
actually start using it for more complex cases, and then you use that
for just about the least interesting case. And the way you do the
dynamic allocator, nobody can ever allocate one of the wait-queue
entries *efficiently* by just knowing that they are a leaf and there
is never any recursive allocation.
So quite frankly, I'd add *one* static wait-queue entry, and use it
unconditionally (no "allocation" wrapper) in all the cases where we
see that all that ever happens is
And then I'd make ___wait_event() use that one statically allocated
per-thread wait-queue instead of the current on-stack one. That would
get a lot of users in one fell swoop. We might have to add some
validation code that the "event" function cannot do anything that can
in turn sleep, but that sounds fairly simple.
See?
Linus
--
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/