Re: Active waiting with yield()

From: Alan Cox
Date: Fri Nov 14 2008 - 16:21:20 EST


> If I have a race condition that gets triggered just for one user in the
> world when repeatedly loading & unloading a driver for an hour, and I use
> yield() to solve it, what's wrong with it? A wait queue increases cache
> footprint for every user. (even if I use preallocated hashed wait queue,
> it still eats a cacheline to access it and find out that it's empty)

Reread what I wrote.

You don't need to use a hashed queue, you don't need to even reference
the queue in the normal case. You cost is one variable, which you can
probably sensibly locate, and a predicted jump.

For that you get proper sleeping behaviour, CPU used by other tasks or
guests and you don't hang on hard real time tasks.
--
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/