lkml.org 
[lkml]   [2010]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [thiscpuops upgrade 05/10] x86: Use this_cpu_inc_return for nmi counter
On 11/26/2010 06:02 PM, Christoph Lameter wrote:
> On Fri, 26 Nov 2010, Tejun Heo wrote:
>
>>> - __this_cpu_inc(alert_counter);
>>> - if (__this_cpu_read(alert_counter) == 5 * nmi_hz)
>>> + if (__this_cpu_inc_return(alert_counter) == 5 * nmi_hz)
>>
>> Hmmm... one worry I have is that xadd, being not a very popular
>> operation, might be slower than add and read. Using it for atomicity
>> would probably be beneficial in most cases but have you checked this
>> actually is cheaper?
>
> XADD takes 3 uops. INC 1 and MOV 1 uop. So there is an additiona uop.
>
> However, a memory fetch from l1 takes a mininum 4 cycles. Doing that twice
> already ends up with at least 8 cycles.

Thanks for the explanation. It might be beneficial to note
performance characteristics on top of the x86 implementation?
Anyways, for this and the following simple conversion patches.

Reviewed-by: Tejun Heo <tj@kernel.org>

--
tejun


\
 
 \ /
  Last update: 2010-11-26 18:09    [W:0.048 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site