[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080321003604.GC20788@khazad-dum.debian.net>
Date: Thu, 20 Mar 2008 21:36:04 -0300
From: Henrique de Moraes Holschuh <hmh@....eng.br>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: David Brownell <david-b@...bell.net>,
Richard Purdie <rpurdie@...ys.net>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>
Subject: Re: use of preempt_count instead of in_atomic() at leds-gpio.c
On Thu, 20 Mar 2008, Andrew Morton wrote:
> On Thu, 20 Mar 2008 19:56:12 -0300 Henrique de Moraes Holschuh <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.
ACK. Richard? I have changed the thinkpad-acpi LED support to always defer
to a workqueue right now, but this *really* wants a LED class API fixup.
I'm for adding an specific hook for atomic access, but a flag would be good
enough too.
Well, so far so good for LEDs, but what about the other users of in_atomic
that apparently should not be doing it either?
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists