[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
|
|
Subscribe / Log in / New account

Re: use of preempt_count instead of in_atomic() at leds-gpio.c

From:  Andrew Morton <akpm-AT-linux-foundation.org>
To:  Henrique de Moraes Holschuh <hmh-AT-hmh.eng.br>
Subject:  Re: use of preempt_count instead of in_atomic() at leds-gpio.c
Date:  Thu, 20 Mar 2008 16:47:41 -0700
Message-ID:  <20080320164741.734e838c.akpm@linux-foundation.org>
Cc:  David Brownell <david-b-AT-pacbell.net>, Richard Purdie <rpurdie-AT-rpsys.net>, linux-kernel-AT-vger.kernel.org, Ingo Molnar <mingo-AT-elte.hu>
Archive‑link:  Article

On Thu, 20 Mar 2008 19:56:12 -0300 Henrique de Moraes Holschuh <hmh@hmh.eng.br> wrote:

> Can we add "in_scheduleable()", or maybe "can_schedule()", that returns
> in_atomic() if CONFIG_PREEMT, or 0 if there is no way to know?   To my
> limited knowledge of how that part of the kernel works, it would do the
> right thing.

If we did that, then people would use it.  And that would be bad.  It'll
lead to code which behaves differently on non-preemptible kernels, to code
which works less well on non-preemptible kernels and it will lead to less
well-thought-out code in general.

Really, this all points at an ill-designed part of the leds interface.  The
consistent pattern we use in the kernel is that callers keep track of
whether they are running in a schedulable context and, if necessary, they
will inform callees about that.  Callees don't work it out for themselves.




to post comments


Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds