Re: [PATCH 17/21] workqueue: simple reimplementation of SINGLE_THREAD workqueue

Linus Torvalds
2009-11-17T19:04:17Z

On Wed, 18 Nov 2009, Tejun Heo wrote:
>
> I might have been too early with the 'easy' part but I definitely can
> give it a shot. What do you think about the scheduler notifier
> implementation? It seems we'll end up with three callbacks. It can
> either be three hlist_heads in the struct_task linking each ops or
> single hilst_head links ops tables (like the current preempt
> notifiers). Which one should I go with?

I have to say that I don't know. Will this eventually be something common?
Is the cache footprint problem of 3 pointers that are usually empty worse
than the cache problem of following a chain where you don't use half the
entries? Who knows?

And when it actually _is_ used, is it going to be horrible to have a
possibly upredictable indirect branch (and on some architectures, _all_
indirect branches are unpredictable) in a really hot path?

In general, "notifiers" are always horrible. If there's only one or two
common cases, it's probably going to be better to hardcode those with
flags to be tested instead of following function pointers. So I just don't
know.

Linus