lkml.org 
[lkml]   [2010]   [Dec]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@cs.helsinki.fi>
> Cc: Hugh Dickins <hughd@google.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Christoph Lameter <cl@linux.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


\
 
 \ /
  Last update: 2010-12-07 15:33    [W:0.103 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site