Skip to contentSkip to conversation

What is the difference between percpu_xxx and this_cpu_xxx?

DISCUSSION Huang Ying 3 participants 4 messages Sep 13, 2011

lore
Share & tools
lore

Huang Ying

author
#0 lore raw

Hi,

If my understanding was correct, from the kernel source code, it appears that percpu_xxx and this_cpu_xxx have the same semantics and implementation in effect, haven’t them?

If so, why do we need two API for the same thing?

Best Regards,
Huang Ying

#1 lore raw
Quoted 7 lines · Huang Ying

Hi,

If my understanding was correct, from the kernel source code, it appears that percpu_xxx and this_cpu_xxx have the same semantics and implementation in effect, haven’t them?

If so, why do we need two API for the same thing?

History mostly, and transition.

percpu_inc() was an x86 only thing

__get_cpu_var(var)++ -> percpu_inc(var) -> this_cpu_inc(var)

author
#2 lore raw

Hi, Eric,

Quoted 7 lines · Eric Dumazet
Quoted 6 lines · Huang Ying

Hi,

If my understanding was correct, from the kernel source code, it appears that percpu_xxx and this_cpu_xxx have the same semantics and implementation in effect, haven’t them?

Quoted 7 lines
Quoted 1 line

If so, why do we need two API for the same thing?

History mostly, and transition.

percpu_inc() was an x86 only thing

__get_cpu_var(var)++ -> percpu_inc(var) -> this_cpu_inc(var)

Thanks for clarification. Is there someone working on the transition? Is that possible to translate most percpu_xxx to this_cpu_xxx blindly?

Best Regards,
Huang Ying

#3 lore raw
Quoted 17 lines · Huang Ying

Hi, Eric,

Quoted 14 lines · Eric Dumazet
Quoted 7 lines · Huang Ying

Hi,

If my understanding was correct, from the kernel source code, it appears that percpu_xxx and this_cpu_xxx have the same semantics and implementation in effect, haven’t them?

If so, why do we need two API for the same thing?

History mostly, and transition.

percpu_inc() was an x86 only thing

__get_cpu_var(var)++ -> percpu_inc(var) -> this_cpu_inc(var)

Also, we used to need separate accessors for static and dynamic percpu variables, so we have quite a few duplications in the interface.

Quoted 2 lines

Thanks for clarification. Is there someone working on the transition? Is that possible to translate most percpu_xxx to this_cpu_xxx blindly?

It's on my todo list but AFAIK nobody is actually working on it yet.

Thanks.

Signature · 1 line
tejun