[linux-audio-dev] Re: [announce] [patch] Voluntary Kernel Preemption Patch

Bill Huey (hui) bhuey at lnxw.com
Thu Jul 29 19:25:10 UTC 2004


On Thu, Jul 29, 2004 at 03:17:52PM -0400, Scott Wood wrote:
> On Thu, Jul 29, 2004 at 11:36:26AM -0700, Bill Huey wrote:
> There are legitimate reasons to use smp_processor_id() outside of a
> non-preemptible region, though.  These include debugging
> printks/logging, and situations where the awareness of CPU is for
> optimization rather than correctness (for example, using per-cpu data
> with per-cpu locks, which are only contended if preemption occurs, or
> per-cpu counters incremented with atomic operations (or where counter
> accuracy is not critical)).
> 
> The detection mechanism we used in 2.4 was simply to grep for
> smp_processor_id and check/fix everything manually (which is somewhat
> tedious, but there aren't *too* many instances in core code, and many
> uses are similar to one another).

That's a better method. But if there's a need for a kind of runtime
detector, I guess you could do that. The use of smp_processor_id() should
be seldom enough that manually fixing all of the points really should
be the solution.

bill




More information about the Linux-audio-dev mailing list