Re: [PATCH] percpu: preemptless __per_cpu_counter_add

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, Christoph.

On Mon, Apr 18, 2011 at 09:38:03AM -0500, Christoph Lameter wrote:
> Preemption flips are not cheap since enabling preemption may mean a call
> into the scheduler. On RT things get more expensive.
> 
> Preempt_enable means at least one additional branch. We are saving a
> branch by not using preempt.

It is cheap.  The cost of preempt_enable() regarding scheduler call is
TIF_NEED_RESCHED check.  The scheduler() call occurring afterwards is
not the overhead of preemption check, but the overhead of preemption
itself.  Also, in cases where the preemption check doesn't make sense
(I don't think that's the case here), the right thing to do is using
preempt_enable_no_resched().

> In order to make it simple I avoided an preempt enable/disable. With
> Shaohua's patches there will be a simple atomic_add within the last if
> cluase. I was able to consolidate multiple code paths into the cmpxchg
> loop with this approach.
> 
> The one below avoids the #ifdef that is ugly...

That said, combined with Shaohua's patch, maybe it's better this way.
Let's see...

Thanks.

-- 
tejun

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]