Re: [PATCH] might_sleep() improvements

From: Nick Piggin
Date: Tue Sep 02 2003 - 03:46:10 EST




Linus Torvalds wrote:

Nick Piggin wrote:

I think these should be pushed down to where the sleeping
actually happens if possible.


No, that ends up doing the wrong thing for most of the really common cases.

In particular, most of the memory allocation functions very seldom actually
sleep. After all, they'll find plenty of free memory (or easily freeable
memory) without having to wait for any pageouts or anything like that.

Yet the bug is there - the call _could_ have slept.

So "might_sleep()" really does what the name suggests: it is used to say
that a particular case _may_ sleep, even if it ends up being unlikely.

Because what we're after is not a bug actually happening, but a latent bug
that has been hidden by the fact that it happens so rarely in practice.

This is why "might_sleep()" should happen as early as possible, and not
get pushed down.



Yes I see. I agree. I thought some could be pushed down further without
losing info. I was mainly worried about adding the might_sleep_if
function.


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