From: Nick Piggin <piggin@cyberone.com.au>
To: Mitchell Blank Jr <mitch@sfgoth.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] might_sleep() improvements
Date: Tue, 02 Sep 2003 18:39:13 +1000 [thread overview]
Message-ID: <3F545731.80808@cyberone.com.au> (raw)
In-Reply-To: <20030902083256.GA52644@gaz.sfgoth.com>
Mitchell Blank Jr wrote:
>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.
>
>
Yeah well in this case I guess skb_unshare is as low as might_sleep
can be pushed. I guess I don't have a problem with might_sleep_if as
long as its used nicely.
next prev parent reply other threads:[~2003-09-02 8:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-02 7:51 [PATCH] might_sleep() improvements Mitchell Blank Jr
2003-09-02 8:14 ` Nick Piggin
2003-09-02 8:32 ` Mitchell Blank Jr
2003-09-02 8:39 ` Nick Piggin [this message]
2003-09-02 8:36 ` Linus Torvalds
2003-09-02 8:44 ` Nick Piggin
2003-09-02 13:55 ` Robert Love
2003-09-02 18:39 ` Mitchell Blank Jr
2003-09-09 3:10 ` Rob Landley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F545731.80808@cyberone.com.au \
--to=piggin@cyberone.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=mitch@sfgoth.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox