From: Ingo Molnar <mingo@elte.hu>
To: Mikael Pettersson <mikpe@csd.uu.se>
Cc: arjan@infradead.org, kaos@sgi.com, linux-kernel@vger.kernel.org
Subject: Re: 2.6.12-rc2 in_atomic() picks up preempt_disable()
Date: Thu, 7 Apr 2005 20:59:23 +0200 [thread overview]
Message-ID: <20050407185923.GA12012@elte.hu> (raw)
In-Reply-To: <200504071840.j37Iei25019895@harpo.it.uu.se>
* Mikael Pettersson <mikpe@csd.uu.se> wrote:
> On Thu, 07 Apr 2005 12:17:37 +0200, Arjan van de Ven wrote:
> >On Thu, 2005-04-07 at 20:10 +1000, Keith Owens wrote:
> >> 2.6.12-rc2, with CONFIG_PREEMPT and CONFIG_PREEMPT_DEBUG. The
> >> in_atomic() macro thinks that preempt_disable() indicates an atomic
> >> region so calls to __might_sleep() result in a stack trace.
> >
> >but you're not allowed to schedule when preempt is disabled!
>
> That sounds draconian. Where is that requirement stated?
(in the code, and in lkml discussions, as usual. There's tons of code
that correctly handled it and continues to handle it. Let me be clear,
this isnt some obscure side-effect, this is one of the cornerstones,
preempt_disable()/enable() always had these semantics, and this is very
much being relied on in a number of areas.)
> A preempt-disabled region ought to have the same semantics as in a
> CONFIG_PREEMPT=n kernel, and since schedule is Ok in the latter case
> it should be Ok in the former too.
>
> All that preempt_disable() should do is prevent involuntary schedules.
> But the conditional schedules introduced by may-sleep functions are
> _voluntary_, so there's no reason to forbid them.
this just hides bugs and introduces bugs. From a critical section POV a
voluntary preemption is almost the same thing as a voluntary preemption
- the task may wander to another CPU, and smp_processor_id() might
become different. If it's not a problem for your code to preempt then
just enable preemption before calling it. Anyway, preempt_disable() /
preempt_enable() is pretty much an internal interface and shouldnt be
used lightly.
Ingo
next prev parent reply other threads:[~2005-04-07 19:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-07 18:40 Mikael Pettersson
2005-04-07 18:59 ` Ingo Molnar [this message]
2005-04-07 20:17 ` Arjan van de Ven
-- strict thread matches above, loose matches on Subject: below --
2005-04-07 10:10 Keith Owens
2005-04-07 10:17 ` Arjan van de Ven
2005-04-07 12:24 ` Romano Giannetti
2005-04-07 10:22 ` Andrew Morton
2005-04-07 14:54 ` Ingo Molnar
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=20050407185923.GA12012@elte.hu \
--to=mingo@elte.hu \
--cc=arjan@infradead.org \
--cc=kaos@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikpe@csd.uu.se \
/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®