[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1012061228010.5099@router.home>
Date: Mon, 6 Dec 2010 12:29:46 -0600 (CST)
From: Christoph Lameter <cl@...ux.com>
To: Matt Mackall <mpm@...enic.com>
cc: Tejun Heo <tj@...nel.org>, akpm@...ux-foundation.org,
Richard Kennedy <richard@....demon.co.uk>,
Pekka Enberg <penberg@...helsinki.fi>,
linux-kernel@...r.kernel.org,
Eric Dumazet <eric.dumazet@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: [cpuops inc_return V1 8/9] random: Use this_cpu_inc_return
On Mon, 6 Dec 2010, Matt Mackall wrote:
> On Mon, 2010-12-06 at 11:40 -0600, Christoph Lameter wrote:
> > plain text document attachment (cpuops_inc_return_random)
> > __this_cpu_inc can create a single instruction to do the same as
> > __get_cpu_var()++.
>
> > - (__get_cpu_var(trickle_count)++ & 0xfff))
> > + ((__this_cpu_inc_return(trickle_count) - 1) & 0xfff))
>
> I see you've added a "- 1" to mimic the post-increment ++ semantic.
>
> The goal of this code to add only 1 sample in every 4096, but we don't
> really care which, so this semantic isn't actually important here.
-1 also removes the + 1 that the inc_return() semantics require because we
use xadd on x86. -1 will generate more compact code.
--
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