Skip to content

use this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id())

Shan Wei lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 30 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9net: core: use this_cpu_ptr per-cpu helpernet/core/flow.c+1 -31 reply
2/9net: rds: use this_cpu_ptr per-cpu helpernet/rds/ib_recv.c+1 -11 reply
3/9net: xfrm: use this_cpu_ptr per-cpu helpernet/xfrm/xfrm_ipcomp.c+3 -46 replies
4/9net: openvswitch: use this_cpu_ptr per-cpu helpernet/openvswitch/datapath.c net/openvswitch/vport.c+4 -56 replies
5/9ftrace: use this_cpu_ptr per-cpu helperinclude/trace/ftrace.h+1 -31 reply
6/9kernel: padata : use this_cpu_ptr per-cpu helperkernel/padata.c+1 -11 reply
7/9rcu: use this_cpu_ptr per-cpu helper instead of per_cpu_ptr(p, raw_smp_processor_id())kernel/rcutree.c+1 -17 replies
8/9trace: use this_cpu_ptr per-cpu helperkernel/trace/blktrace.c kernel/trace/trace.c+2 -25 replies
9/9clocksource: use this_cpu_ptr per-cpu helperdrivers/clocksource/arm_generic.c+1 -11 reply

Reviews trailers per patch

4 of 9 patches have a Reviewed-by or Acked-by.

PatchChristoph Lameter
1/9R-b
2/9R-b
3/9
4/9
5/9R-b
6/9
7/9
8/9
9/9R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/9] use this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id())

this_cpu_ptr is faster than per_cpu_ptr(p, smp_processor_id()). The latter helper needs to find the offset for current cpu, and needs more assembler instructions which objdump shows in following.

per_cpu_ptr(p, smp_processor_id()):

  1e:   65 8b 04 25 00 00 00 00         mov    %gs:0x0,%eax
  26:   48 98                           cltq
  28:   31 f6                           xor    %esi,%esi
  2a:   48 c7 c7 00 00 00 00            mov    $0x0,%rdi
  31:   48 8b 04 c5 00 00 00 00         mov    0x0(,%rax,8),%rax
  39:   c7 44 10 04 14 00 00 00         movl   $0x14,0x4(%rax,%rdx,1)

this_cpu_ptr(p)

  1e:   65 48 03 14 25 00 00 00 00      add    %gs:0x0,%rdx
  27:   31 f6                           xor    %esi,%esi
  29:   c7 42 04 14 00 00 00            movl   $0x14,0x4(%rdx)
  30:   48 c7 c7 00 00 00 00            mov    $0x0,%rdi
$ git diff --stat a932657f51eadb8280166e82dc7034dfbff3985a..
 drivers/clocksource/arm_generic.c |    2 +-
 include/trace/ftrace.h            |    4 +---
 kernel/padata.c                   |    2 +-
 kernel/rcutree.c                  |    2 +-
 kernel/trace/blktrace.c           |    2 +-
 kernel/trace/trace.c              |    2 +-
 net/core/flow.c                   |    4 +---
 net/openvswitch/datapath.c        |    4 ++--
 net/openvswitch/vport.c           |    5 ++---
 net/rds/ib_recv.c                 |    2 +-
 net/xfrm/xfrm_ipcomp.c            |    7 +++----
 11 files changed, 15 insertions(+), 21 deletions(-)