[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1011261047460.13524@router.home>
Date: Fri, 26 Nov 2010 11:02:45 -0600 (CST)
From: Christoph Lameter <cl@...ux.com>
To: Tejun Heo <tj@...nel.org>
cc: akpm@...ux-foundation.org, Pekka Enberg <penberg@...helsinki.fi>,
linux-kernel@...r.kernel.org,
Eric Dumazet <eric.dumazet@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: [thiscpuops upgrade 05/10] x86: Use this_cpu_inc_return for nmi
counter
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.
--
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