[lkml]   [2003]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] might_sleep() improvements
Nick Piggin wrote:
> >Andrew - I thought this might be appropriate for -mm kernels.
> >
> >This patch makes the following improvements to might_sleep():
> >
> >o Add a "might_sleep_if()" macro for when we might sleep only if some
> > condition is met. I think this is a bit better than the currently used
> > "if (cond) might_sleep();" since it's clearer that the test won't be
> > compiled in if spinlock sleep debugging is turned off. (Obviously
> > gcc is smart enough to omit simple conditions in that case) It also
> > looks cleaner, IMO. Think of it as analogous to BUG()/BUG_ON().
> >
> I think these should be pushed down to where the sleeping
> actually happens if possible.

No, you want to generate the warning as early as possible in case the
sleeping case happens very infrequently. For instance:

newskb = skb_unshare(skb, GFP_KERNEL);

might not even need to do any allocation (much less a sleep) in 99.9% of
cases, but it's still a bug if it's called in atomic context and we want
spinlock sleep debugging to catch that for us.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:48    [W:0.079 / U:3.252 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site