Re: [PATCH] might_sleep() improvements

From: Robert Love
Date: Tue Sep 02 2003 - 12:10:53 EST


On Tue, 2003-09-02 at 03:51, Mitchell Blank Jr wrote:

> Andrew - I thought this might be appropriate for -mm kernels.
>
> This patch makes the following improvements to might_sleep():

Good. These checks are very useful.

> o Add a "might_sleep_if()" macro for when we might sleep only if some
> condition is met.

But I am neutral about this. One thing that BUG_ON() gives is that the
if has an unlikely() in it, so it at least guarantees some improved
semantics.

Another bit is that we have historically avoided conditional code (i.e.,
cruft like smp_if() etc. that you see elsewhere) like this. Maybe
renaming this "might_sleep_on()" at least brings it more in line with
BUG_ON(), and avoids looking like the gross constructs I fear.

> o Add might_sleep checks to skb_share_check() and skb_unshare() which
> sometimes need to allocate memory.

Great.

> o Make all architectures call might_sleep() in both down() and
> down_interruptible(). Before only ppc, ppc64, and i386 did this check.
> (sh did the check on down() but not down_interruptible())

Even better.

Robert Love


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