From: Robert Love <rml@tech9.net>
To: Jesse Barnes <jbarnes@sgi.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lock assertion macros for 2.5.28
Date: 26 Jul 2002 12:38:37 -0700 [thread overview]
Message-ID: <1027712317.2442.45.camel@sinai> (raw)
In-Reply-To: <20020726174258.GC793866@sgi.com>
On Fri, 2002-07-26 at 10:42, Jesse Barnes wrote:
> Well, I had that in one version of the patch, but people didn't think
> it would be useful. Maybe you'd like to check out Oliver's comments
> at http://marc.theaimsgroup.com/?l=linux-kernel&m=102644431806734&w=2
> and respond? If there's demand for MUST_NOT_HOLD, I'd be happy to add
> it since it should be easy. But if you're using it to enforce lock
> ordering as Oliver suggests, then there are probably more robust
> solutions.
Two other suggestions you could implement are CAN_SLEEP and
CANNOT_SLEEP. You can implement them via the preempt_count.
Even if CONFIG_PREEMPT is not set, you will get preempt_count values
representing whether or not you are in an interrupt or softirq (and thus
atomic and cannot sleep). If CONFIG_PREEMPT is set, you get a counter
that represents exactly the atomicity of the code including locks held.
E.g.,
#define CAN_SLEEP do { \
assert(unlikely(!preempt_count())); \
} while (0)
#define CANNOT_SLEEP do { \
assert(unlikely(preempt_count())); \
} while (0)
This works great because after the IRQ changes in 2.5.28, preempt_count
is a universal "are we atomic" count.
Robert Love
next prev parent reply other threads:[~2002-07-26 19:35 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-25 23:30 Jesse Barnes
2002-07-26 5:11 ` Marcin Dalecki
2002-07-26 17:40 ` Jesse Barnes
2002-07-27 13:59 ` Daniel Phillips
2002-07-26 12:09 ` Joshua MacDonald
2002-07-26 17:42 ` Jesse Barnes
2002-07-26 17:54 ` Christoph Hellwig
2002-07-26 18:05 ` Jesse Barnes
2002-07-27 13:56 ` Daniel Phillips
2002-07-26 19:38 ` Robert Love [this message]
2002-08-02 15:17 ` Joshua MacDonald
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=1027712317.2442.45.camel@sinai \
--to=rml@tech9.net \
--cc=jbarnes@sgi.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®