[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4CFE44E2.9050408@kernel.org>
Date: Tue, 07 Dec 2010 15:29:54 +0100
From: Tejun Heo <tj@...nel.org>
To: Christoph Lameter <cl@...ux.com>
CC: akpm@...ux-foundation.org, Pekka Enberg <penberg@...helsinki.fi>,
Hugh Dickins <hughd@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org,
Eric Dumazet <eric.dumazet@...il.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Subject: Re: [Use cpuops V1 05/11] core: Replace __get_cpu_var with __this_cpu_read
if not used for an address.
Hello,
On 12/06/2010 06:16 PM, Christoph Lameter wrote:
> __get_cpu_var() can be replaced with this_cpu_read and will then use a single
> read instruction with implied address calculation to access the correct per cpu
> instance.
>
> However, the address of a per cpu variable passed to __this_cpu_read() cannot be
> determed (since its an implied address conversion through segment prefixes).
> Therefore apply this only to uses of __get_cpu_var where the addres of the
> variable is not used.
>
> Cc: Pekka Enberg <penberg@...helsinki.fi>
> Cc: Hugh Dickins <hughd@...gle.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Signed-off-by: Christoph Lameter <cl@...ux.com>
...
> @@ -802,18 +802,18 @@ static void takeover_tasklets(unsigned i
>
> /* Find end, append list for that CPU. */
> if (&per_cpu(tasklet_vec, cpu).head != per_cpu(tasklet_vec, cpu).tail) {
> - *(__get_cpu_var(tasklet_vec).tail) = per_cpu(tasklet_vec, cpu).head;
> - __get_cpu_var(tasklet_vec).tail = per_cpu(tasklet_vec, cpu).tail;
> + *__this_cpu_read(tasklet_vec.tail) = per_cpu(tasklet_vec, cpu).head;
> + this_cpu_write(tasklet_vec.tail, per_cpu(tasklet_vec, cpu).tail);
> per_cpu(tasklet_vec, cpu).head = NULL;
> per_cpu(tasklet_vec, cpu).tail = &per_cpu(tasklet_vec, cpu).head;
> }
> raise_softirq_irqoff(TASKLET_SOFTIRQ);
>
> if (&per_cpu(tasklet_hi_vec, cpu).head != per_cpu(tasklet_hi_vec, cpu).tail) {
> - *__get_cpu_var(tasklet_hi_vec).tail = per_cpu(tasklet_hi_vec, cpu).head;
> - __get_cpu_var(tasklet_hi_vec).tail = per_cpu(tasklet_hi_vec, cpu).tail;
> + *__this_cpuo_read(tasklet_hi_vec.tail) = per_cpu(tasklet_hi_vec, cpu).head;
> + __this_cpu_write(tasklet_hi_vec.tail, per_cpu(tasklet_hi_vec, cpu).tail;
I don't think __this_cpuo_read() would build.
--
tejun
--
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