lkml.org 
[lkml]   [2009]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] add optimized generic percpu accessors
Hello,

Ingo Molnar wrote:
> The new ops are a pretty nice and clean solution i think.
>
> Firstly, accessing the current CPU is the only safe shortcut anyway (there
> is where we can do %fs/%gs / rip-relative addressing modes), and the
> generic per_cpu() APIs dont really provide that guarantee for us. We might
> be able to hook into __get_cpu_var() but those both require to be an
> lvalue and are also relatively rarely used.
>
> So introducing the new, rather straightforward APIs and using them
> wherever they matter for performance is good. Your patchset already shaved
> off an instruction from ordinary per_cpu() accesses, so it's all moving
> rather close to the most-optimal situation already.

Yeah, I don't think we can do much better than those ops. I have two
issues tho.

1. percpu_and() is missing. I added it for completeness's sake.

2. The generic percpu_op() should be local to the cpu, so it should
expand to...

do { get_cpu_var(var) OP (val); put_cpu_var(var) } while (0)

as the original x86_OP_percpu() did. Right?

Thanks.

--
tejun


\
 
 \ /
  Last update: 2009-01-15 12:43    [W:0.254 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site