Re: [patch] Voluntary Kernel Preemption, 2.6.12-rc4-mm2

From: Ingo Molnar
Date: Tue May 24 2005 - 10:12:27 EST



* Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:

> I still disagree with this one violently. [...]

(then you must be disagreeing with CONFIG_PREEMPT too to a certain
degree i guess?)

> [...] If you want a cond_resched() add it where nessecary, but don't
> hide it behind might_sleep - there could be quite a lot might_sleeps
> in common codepathes and they should stay purely a debug aid.

The recent prolifation of might_sleep() points was a direct result of
the -VP patch. I _did_ measure and lay out the might_sleep()s so that
key latency paths get cut. If we did what you propose we'd end up
duplicating 95% of the current might_sleep() invocations. So instead of
sprinking the source with cond_resched()s, we implicitly get them via
might_sleep().

there's another argument as well: if a function truly might sleep, it's
in most cases complex enough to not worry about one extra need_resched()
check. So might_sleep() and cond_resched() pair better than one would
think.

(it is also a debugging helper: by actually sleeping at might_sleep()
points we truly explore whether preemption at that point is safe.)

or if you think we can get away with using just a couple of
cond_resched()s then you are my guest to prove me wrong: take the -RT
kernel it has both -VP and the latency measurement tools integrated, and
remove the cond_resched() from might_sleep() and try to find the points
that are necessary to cut down latencies so that they fall into the
1msec range on typical hw.

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