[PATCH buf-fix] kernel, range: fix broken mtrr_cleanup

2013-06-09 Thread Shan Wei
From: Samuel Liao commit fbe06b7bae7c9cf6ab05168fce5ee93b2f4bae7c broken the mtrr_cleanup due to return incorrect merged range. this patch remove the empty range by swapping with the last. Error messages: Jun 9 14:06:18 kernel: [0.00] *BAD*gran_size: 64K chunk_size: 64K num_

[tip:perf/core] tracing: Use __this_cpu_inc/ dec operation instead of __get_cpu_var

2013-02-03 Thread tip-bot for Shan Wei
Commit-ID: 821465295b36136998ef294fe176fba4e09c1cd9 Gitweb: http://git.kernel.org/tip/821465295b36136998ef294fe176fba4e09c1cd9 Author: Shan Wei AuthorDate: Mon, 19 Nov 2012 13:21:01 +0800 Committer: Steven Rostedt CommitDate: Fri, 25 Jan 2013 20:36:54 -0500 tracing: Use __this_cpu_inc

[tip:perf/core] tracing: Use this_cpu_ptr per-cpu helper

2013-01-24 Thread tip-bot for Shan Wei
Commit-ID: d8a0349c0cea477322c66ea9362f10c62fad5f62 Gitweb: http://git.kernel.org/tip/d8a0349c0cea477322c66ea9362f10c62fad5f62 Author: Shan Wei AuthorDate: Tue, 13 Nov 2012 09:53:04 +0800 Committer: Steven Rostedt CommitDate: Mon, 21 Jan 2013 13:22:30 -0500 tracing: Use this_cpu_ptr

[tip:perf/core] tracing: Kill unused and puzzled sample code in ftrace.h

2012-12-09 Thread tip-bot for Shan Wei
Commit-ID: 1c7d66732458dc187008e3f5b2f71e019e320fc2 Gitweb: http://git.kernel.org/tip/1c7d66732458dc187008e3f5b2f71e019e320fc2 Author: Shan Wei AuthorDate: Sat, 3 Nov 2012 12:38:33 +0800 Committer: Steven Rostedt CommitDate: Tue, 13 Nov 2012 15:51:21 -0500 tracing: Kill unused and

Re: [PATCH] net: core: fix unused variable sparse warning

2012-12-07 Thread Shan Wei
Cong Ding said, at 2012/12/7 8:15: > On Fri, Dec 07, 2012 at 12:06:44AM +, Cong Ding wrote: >> the variables zero and unres_qlen_max are only used when CONFIG_SYSCTL is >> defined, otherwise it causes the following sparse warning when we turn on >> CONFIG_SYSCTL. > sorry for disturbing again, t

Re: [PATCH v4 7/9] trace: use this_cpu_ptr per-cpu helper

2012-11-29 Thread Shan Wei
Shan Wei said, at 2012/11/16 16:34: > Shan Wei said, at 2012/11/13 9:53: >> From: Shan Wei >> >> typeof(&buffer) is a pointer to array of 1024 char, or char (*)[1024]. >> But, typeof(&buffer[0]) is a pointer to char which match the return type of >> get

Re: [PATCH] trace: use __this_cpu_inc/dec operation instead of __get_cpu_var

2012-11-29 Thread Shan Wei
ping .. Shan Wei said, at 2012/11/19 13:21: > From: Shan Wei > > __this_cpu_inc_return() or __this_cpu_dec generates a single instruction, > which is faster than __get_cpu_var operation. > > Signed-off-by: Shan Wei > --- > kernel/trace/trace.c |4 ++

Re: [PATCH v4] drivers: staging: remove last usage of NIPQUAD and NIP6 in gdm72xx

2012-11-27 Thread Shan Wei
Greg KH said, at 2012/11/28 1:19: > On Tue, Nov 27, 2012 at 10:37:46AM +0800, Shan Wei wrote: >> From: Shan Wei >> >> commit cf4ca4874fc45 removed the definition of NIPQUAD and NIPQUAD_FMT, >> and NIP6 also is out of date. >> >> Because DEBUG_SDU is not d

[PATCH v3] drivers: staging: remove last usage of NIPQUAD and NIP6 in gdm72xx

2012-11-26 Thread Shan Wei
From: Shan Wei commit cf4ca4874fc45 removed the definition of NIPQUAD and NIPQUAD_FMT, and NIP6 also is out of date. Because DEBUG_SDU is not defined in gdm_wimax.h, no error message when compiling this code. And remove constant condition judge. Signed-off-by: Shan Wei --- V3: As

[PATCH v2] drivers: gdm72xx: remove last usage of NIPQUAD and NIP6

2012-11-22 Thread Shan Wei
From: Shan Wei commit cf4ca4874fc45 removed the definition of NIPQUAD and NIPQUAD_FMT, and NIP6 also is out of date. Because DEBUG_SDU is not defined in gdm_wimax.h, no error message when compiling this code. commit cf4ca4874fc45166198424384275f443a672d0b7 Author: Joe Perches Date: Mon Aug

[PATCH] drivers: ddm72xx: remove last usage of NIPQUAD and NIP6

2012-11-22 Thread Shan Wei
From: Shan Wei commit cf4ca4874fc45 removed the definition of NIPQUAD and NIPQUAD_FMT, and NIP6 also is out of date. Because DEBUG_SDU is not defined in gdm_wimax.h, no error message when compiling this code. commit cf4ca4874fc45166198424384275f443a672d0b7 Author: Joe Perches Date: Mon Aug

[PATCH] trace: use __this_cpu_inc/dec operation instead of __get_cpu_var

2012-11-18 Thread Shan Wei
From: Shan Wei __this_cpu_inc_return() or __this_cpu_dec generates a single instruction, which is faster than __get_cpu_var operation. Signed-off-by: Shan Wei --- kernel/trace/trace.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/trace.c b/kernel

Re: [PATCH v4 2/9] net: rds: use this_cpu_* per-cpu helper

2012-11-16 Thread Shan Wei
Shan Wei said, at 2012/11/13 9:52: > From: Shan Wei > > > Signed-off-by: Shan Wei > Reviewed-by: Christoph Lameter David Miller, would you like to pick it up to your net-next tree? > --- > v4: > 1. add missing __percpu annotations. > 2. [read|write]ing fields

Re: [PATCH v4 1/9] net: core: use this_cpu_ptr per-cpu helper

2012-11-16 Thread Shan Wei
Shan Wei said, at 2012/11/13 9:51: > From: Shan Wei > > flush_tasklet is a struct, not a pointer in percpu var. > so use this_cpu_ptr to get the member pointer. > > Signed-off-by: Shan Wei > Reviewed-by: Christoph Lameter David Miller, would you like to pick it up

Re: [PATCH v4 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper

2012-11-16 Thread Shan Wei
Shan Wei said, at 2012/11/13 9:52: > From: Shan Wei > > just use more faster this_cpu_ptr instead of per_cpu_ptr(p, > smp_processor_id()); > > > Signed-off-by: Shan Wei > Reviewed-by: Christoph Lameter Jesse Gross, would you like to pick it up to your tree? >

Re: [PATCH v4 7/9] trace: use this_cpu_ptr per-cpu helper

2012-11-16 Thread Shan Wei
Shan Wei said, at 2012/11/13 9:53: > From: Shan Wei > > typeof(&buffer) is a pointer to array of 1024 char, or char (*)[1024]. > But, typeof(&buffer[0]) is a pointer to char which match the return type of > get_trace_buf(). > As well-known, the value of &buffe

Re: [PATCH v3 6/9] rcu: use __this_cpu_read helper instead of per_cpu_ptr(p, raw_smp_processor_id())

2012-11-16 Thread Shan Wei
Shan Wei said, at 2012/11/13 9:52: > From: Shan Wei > > Signed-off-by: Shan Wei > Acked-by: Christoph Lameter Paul, would you like to pick it up to your tree? > --- > no changes vs v3,v2. > --- > kernel/rcutree.c |2 +- > 1 files changed, 1 insertions(+), 1 d

Re: [PATCH 0/9 v4] use efficient this_cpu_* helper

2012-11-16 Thread Shan Wei
network, rcu, trace. The best way to avoid code conflict is subsystem maintainer to pick them up to their code tree. I will remind them in each patch that not yet applied and add you to the receiver list. Best Regards Shan Wei > > Thanks. > -- To unsubscribe from this list: send the li

Re: [PATCH v5 3/9] net: xfrm: use __this_cpu_read per-cpu helper

2012-11-13 Thread Shan Wei
04 14 00 00 00movl $0x14,0x4(%rdx) 30: 48 c7 c7 00 00 00 00mov$0x0,%rdi Signed-off-by: Shan Wei --- net/xfrm/xfrm_ipcomp.c |8 +++- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c index e5246fb.

Re: [B.A.T.M.A.N.] [PATCH v4 9/9] net: batman-adv: use per_cpu_add helper

2012-11-13 Thread Shan Wei
Marek Lindner said, at 2012/11/13 17:55: >> net/batman-adv/main.h |4 +--- >> 1 files changed, 1 insertions(+), 3 deletions(-) > > Applied in our tree (revision f8b19e1). We will pass along this patch through > our standard workflow. No need to resend this patch in the future. OK thanks~ >

Re: [PATCH v4 3/9] net: xfrm: use __this_cpu_read per-cpu helper

2012-11-13 Thread Shan Wei
Steffen Klassert said, at 2012/11/13 15:21: > > This should just fetch the tfm pointer, so why exactly __this_cpu_read > is better than __this_cpu_ptr? Please keep in mind that performance is > not the most important thing here. It's much more important that it > works in any case. [0/9] describ

[PATCH v4 9/9] net: batman-adv: use per_cpu_add helper

2012-11-12 Thread Shan Wei
From: Shan Wei this_cpu_add is an atomic operation. and be more faster than per_cpu_ptr operation. Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- v4: no changes vs v3. --- net/batman-adv/main.h |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/net/batman

[PATCH v4 8/9] clocksource: use this_cpu_ptr per-cpu helper

2012-11-12 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- no changes vs v3,v2. --- drivers/clocksource/arm_generic.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/clocksource/arm_generic.c b/drivers/clocksource/arm_generic.c index c4d9f95

[PATCH v4 7/9] trace: use this_cpu_ptr per-cpu helper

2012-11-12 Thread Shan Wei
From: Shan Wei typeof(&buffer) is a pointer to array of 1024 char, or char (*)[1024]. But, typeof(&buffer[0]) is a pointer to char which match the return type of get_trace_buf(). As well-known, the value of &buffer is equal to &buffer[0]. so return this_cpu_ptr(&percpu_bu

[PATCH v4 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper

2012-11-12 Thread Shan Wei
From: Shan Wei just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id()); Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- no changes vs v3,v2. --- net/openvswitch/datapath.c |4 ++-- net/openvswitch/vport.c|5 ++--- 2 files changed, 4 insertions

[PATCH v3 6/9] rcu: use __this_cpu_read helper instead of per_cpu_ptr(p, raw_smp_processor_id())

2012-11-12 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei Acked-by: Christoph Lameter --- no changes vs v3,v2. --- kernel/rcutree.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 74df86b..441b945 100644 --- a/kernel/rcutree.c +++ b/kernel

[PATCH v4 5/9] kernel: padata : use __this_cpu_read per-cpu helper

2012-11-12 Thread Shan Wei
From: Shan Wei For bottom halves off, __this_cpu_read is better. Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- no changes vs v4. --- kernel/padata.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/padata.c b/kernel/padata.c index 89fe3d1

[PATCH v4 3/9] net: xfrm: use __this_cpu_read per-cpu helper

2012-11-12 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- v4: derefrence pointer before reading to avoid compile warning. --- net/xfrm/xfrm_ipcomp.c |8 +++- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c index e5246fb..2906d52 100644

[PATCH v4 2/9] net: rds: use this_cpu_* per-cpu helper

2012-11-12 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- v4: 1. add missing __percpu annotations. 2. [read|write]ing fields of struct rds_ib_cache_head using __this_cpu_* operation, drop per_cpu_ptr. --- net/rds/ib.h |2 +- net/rds/ib_recv.c | 24

[PATCH v4 1/9] net: core: use this_cpu_ptr per-cpu helper

2012-11-12 Thread Shan Wei
From: Shan Wei flush_tasklet is a struct, not a pointer in percpu var. so use this_cpu_ptr to get the member pointer. Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- no changes vs v3. --- net/core/flow.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a

[PATCH 0/9 v4] use efficient this_cpu_* helper

2012-11-12 Thread Shan Wei
this_cpu_ptr/this_cpu_read is faster than per_cpu_ptr(p, smp_processor_id()) and can reduce memory accesses. The latter helper needs to find the offset for current cpu, and needs more assembler instructions which objdump shows in following. this_cpu_ptr relocates and address. this_cpu_read() re

Re: [PATCH cleanup RFC] ftrace: kill unused and puzzled sample code in ftrace.h

2012-11-12 Thread Shan Wei
ping... Shan Wei said, at 2012/11/3 12:38: > From: Shan Wei > > When doing per-cpu helper optimizing work, find that this code is so puzzled. > 1. It's mark as comment text, maybe a sample function for guidelines >or a todo work. > 2. But, this s

Re: [PATCH v3 2/9] net: rds: use this_cpu_ptr per-cpu helper

2012-11-12 Thread Shan Wei
Christoph Lameter said, at 2012/11/10 4:09: >> -chp = per_cpu_ptr(cache->percpu, smp_processor_id()); >> +chp = this_cpu_ptr(cache->percpu); >> if (!chp->first) > > if (!__this_cpu_read(cache-0>percpu->first)) > > ? __percpu annotations in struct rds_ib_refill_cache is missing. you

Re: [PATCH v3 7/9] trace: use this_cpu_ptr per-cpu helper

2012-11-11 Thread Shan Wei
Christoph Lameter said, at 2012/11/10 4:15: > On Fri, 9 Nov 2012, Shan Wei wrote: > >> -return buffer->buffer; >> +return (char *)this_cpu_ptr(&percpu_buffer->buffer); >> } > > Add a comment to explain the cast? typeof(&buffer) is a pointer t

Re: [PATCH v3 3/9] net: xfrm: use __this_cpu_read per-cpu helper

2012-11-11 Thread Shan Wei
Christoph Lameter said, at 2012/11/10 4:12: > On Fri, 9 Nov 2012, Shan Wei wrote: > >> v3 fix compile warning: >> net/xfrm/xfrm_ipcomp.c: In function 'ipcomp_alloc_tfms': >> net/xfrm/xfrm_ipcomp.c:285: warning: assignment from incompatible pointer >> type

[PATCH v3 9/9] net: batman-adv: use per_cpu_add helper

2012-11-08 Thread Shan Wei
From: Shan Wei this_cpu_add is an atomic operation. and be more faster than per_cpu_ptr operation. Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- v3: change commit message. --- net/batman-adv/main.h |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/net

[PATCH v3 8/9] clocksource: use this_cpu_ptr per-cpu helper

2012-11-08 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- no changes vs v2. --- drivers/clocksource/arm_generic.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/clocksource/arm_generic.c b/drivers/clocksource/arm_generic.c index c4d9f95

[PATCH v3 7/9] trace: use this_cpu_ptr per-cpu helper

2012-11-08 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- v3: directly return member address of per-cpu variable. --- kernel/trace/blktrace.c |2 +- kernel/trace/trace.c|5 + 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c

[PATCH v3 6/9] rcu: use __this_cpu_read helper instead of per_cpu_ptr(p, raw_smp_processor_id())

2012-11-08 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- no changes vs v2. --- kernel/rcutree.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 74df86b..441b945 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -1960,7 +1960,7

[PATCH v3 5/9] kernel: padata : use __this_cpu_read per-cpu helper

2012-11-08 Thread Shan Wei
From: Shan Wei For bottom halves off, __this_cpu_read is better. Signed-off-by: Shan Wei --- v3: use __this_cpu_read instead of this_cpu_read. --- kernel/padata.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/padata.c b/kernel/padata.c index 89fe3d1

[PATCH v3 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper

2012-11-08 Thread Shan Wei
From: Shan Wei just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id()); Signed-off-by: Shan Wei --- no changes vs v2. --- net/openvswitch/datapath.c |4 ++-- net/openvswitch/vport.c|5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a

[PATCH v3 3/9] net: xfrm: use __this_cpu_read per-cpu helper

2012-11-08 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- v3 fix compile warning: net/xfrm/xfrm_ipcomp.c: In function 'ipcomp_alloc_tfms': net/xfrm/xfrm_ipcomp.c:285: warning: assignment from incompatible pointer type --- net/xfrm/xfrm_ipcomp.c |7 ++- 1 files changed, 2 insertions(+), 5

[PATCH v3 2/9] net: rds: use this_cpu_ptr per-cpu helper

2012-11-08 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- no changes vs v2. --- net/rds/ib_recv.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index 8d19491..a4a5064 100644 --- a/net/rds/ib_recv.c +++ b/net/rds

[PATCH v3 1/9] net: core: use this_cpu_ptr per-cpu helper

2012-11-08 Thread Shan Wei
From: Shan Wei flush_tasklet is a struct, not a pointer in percpu var. so use this_cpu_ptr to get the member pointer. Signed-off-by: Shan Wei --- net/core/flow.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/net/core/flow.c b/net/core/flow.c index e318c7e

[PATCH 0/9 v3] use efficient this_cpu_* helper

2012-11-08 Thread Shan Wei
this_cpu_ptr/this_cpu_read is faster than per_cpu_ptr(p, smp_processor_id()) and can reduce memory accesses. The latter helper needs to find the offset for current cpu, and needs more assembler instructions which objdump shows in following. this_cpu_ptr relocates and address. this_cpu_read() re

Re: [PATCH 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper

2012-11-08 Thread Shan Wei
Christoph Lameter said, at 2012/11/9 1:18: > On Thu, 8 Nov 2012, Shan Wei wrote: > >> Christoph Lameter said, at 2012/11/3 1:46: >>>>u64_stats_update_begin(&stats->sync); >>>>stats->tx_packets++; >>> >>> Us

Re: [PATCH 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper

2012-11-08 Thread Shan Wei
Christoph Lameter said, at 2012/11/3 1:46: >> u64_stats_update_begin(&stats->sync); >> stats->tx_packets++; > > Use this_cpu_inc(vport->percpu_stats->packets) here? Lots of network drivers use u64_stats_sync infrastructure for statistics on 32bit or 64bit hosts no matte

Re: [PATCH v2 6/9] rcu: use __this_cpu_read helper instead of per_cpu_ptr(p, raw_smp_processor_id())

2012-11-04 Thread Shan Wei
Paul E. McKenney said, at 2012/11/3 17:19: > OK, I do understand why it happens to work. My question is instead why > it is considered a good idea. Maybe objdump gives the answer. __this_cpu_read which read member pointer of per-cpu variable can reduce two instructions on x86-64 arch. *test

Re: [B.A.T.M.A.N.] [PATCH v2 9/9] net: batman-adv: use per_cpu_add helper

2012-11-02 Thread Shan Wei
Sven Eckelmann said, at 2012/11/3 1:55: > On Saturday 03 November 2012 00:02:06 Shan Wei wrote: >> From: Shan Wei >> >> As Christoph Lameter said: >>> In addition, following usage of per_cpu_ptr can be replaced by >>> this_cpu_read. >>> &

Re: [PATCH 8/9] trace: use this_cpu_ptr per-cpu helper

2012-11-02 Thread Shan Wei
Christoph Lameter said, at 2012/11/3 1:53: > > hmm what is actually returned is a pointer to char right? And buffer > is char[1024] so I guess then you need to pass a pointer to char to > this_cpu_read. > > return this_cpu_read(&(percpu_buffer->buffer)) still error kernel/trace/trace.c

[PATCH cleanup RFC] ftrace: kill unused and puzzled sample code in ftrace.h

2012-11-02 Thread Shan Wei
From: Shan Wei When doing per-cpu helper optimizing work, find that this code is so puzzled. 1. It's mark as comment text, maybe a sample function for guidelines or a todo work. 2. But, this sample code is odd where struct perf_trace_buf is nonexistent. commit ce71b9 delete s

[PATCH v2 1/9] net: core: use this_cpu_ptr per-cpu helper

2012-11-02 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- net/core/flow.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/net/core/flow.c b/net/core/flow.c index e318c7e..3bad824 100644 --- a/net/core/flow.c +++ b/net/core/flow.c @@ -327,11 +327,9

[PATCH 0/9 v2] use efficient this_cpu_* helper

2012-11-02 Thread Shan Wei
this_cpu_ptr is faster than per_cpu_ptr(p, smp_processor_id()) and can reduce memory accesses. 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

[PATCH v2 9/9] net: batman-adv: use per_cpu_add helper

2012-11-02 Thread Shan Wei
From: Shan Wei As Christoph Lameter said: > In addition, following usage of per_cpu_ptr can be replaced by this_cpu_read. > > cpu=get_cpu() > > *per_cpu_ptr(p,cpu) > > > put_cpu() Right. Signed-off-by: Shan Wei --- net/batman-adv/main.h |4

[PATCH v2 8/9] clocksource: use this_cpu_ptr per-cpu helper

2012-11-02 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- drivers/clocksource/arm_generic.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/clocksource/arm_generic.c b/drivers/clocksource/arm_generic.c index c4d9f95..cb445ab 100644 --- a

[PATCH v2 7/9] trace: use this_cpu_ptr per-cpu helper

2012-11-02 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- kernel/trace/blktrace.c |2 +- kernel/trace/trace.c|2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index c0bd030..71259e2 100644 --- a/kernel/trace/blktrace.c +++ b

[PATCH v2 5/9] kernel: padata : use this_cpu_read per-cpu helper

2012-11-02 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- kernel/padata.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/padata.c b/kernel/padata.c index 89fe3d1..cf94137 100644 --- a/kernel/padata.c +++ b/kernel/padata.c @@ -171,7 +171,7 @@ static struct padata_priv

[PATCH v2 6/9] rcu: use __this_cpu_read helper instead of per_cpu_ptr(p, raw_smp_processor_id())

2012-11-02 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- kernel/rcutree.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 74df86b..441b945 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -1960,7 +1960,7 @@ static void

[PATCH 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper

2012-11-02 Thread Shan Wei
From: Shan Wei no change vs v1. Lots of drivers use this kind to read/write per-cpu variable. stats = this_cpu_ptr(dp->stats_percpu); u64_stats_update_begin(&stats->sync); stats->tx_packets++; u64_stats_update_begin(&stats->sync); Signed-off-by: Shan Wei

[PATCH v2 3/9] net: xfrm: use __this_cpu_read per-cpu helper

2012-11-02 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- net/xfrm/xfrm_ipcomp.c |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c index e5246fb..394d672 100644 --- a/net/xfrm/xfrm_ipcomp.c +++ b/net/xfrm/xfrm_ipcomp.c @@ -276,14

[PATCH v2 2/9] net: rds: use this_cpu_ptr per-cpu helper

2012-11-02 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei Reviewed-by: Christoph Lameter --- net/rds/ib_recv.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index 8d19491..a4a5064 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -423,7

[PATCH 0/9 v2] use efficient this_cpu_* helper

2012-11-02 Thread Shan Wei
this_cpu_ptr is faster than per_cpu_ptr(p, smp_processor_id()) and can reduce memory accesses. 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

Re: [PATCH 8/9] trace: use this_cpu_ptr per-cpu helper

2012-11-02 Thread Shan Wei
Christoph Lameter said, at 2012/11/1 1:50: >> >> -buffer = per_cpu_ptr(percpu_buffer, smp_processor_id()); >> +buffer = this_cpu_ptr(percpu_buffer); >> >> return buffer->buffer; > > > Just do a > > return this_cpu_read(percpu_buffer->buffer); > > and get rid of the this_cpu_p

Re: [PATCH 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper

2012-11-01 Thread Shan Wei
Christoph Lameter said, at 2012/11/1 1:39: > On Wed, 31 Oct 2012, Shan Wei wrote: > >> --- a/net/openvswitch/datapath.c >> +++ b/net/openvswitch/datapath.c >> @@ -208,7 +208,7 @@ void ovs_dp_process_received_packet(struct vport *p, >> struct sk_buff *skb) >>

Re: [PATCH 7/9] rcu: use this_cpu_ptr per-cpu helper instead of per_cpu_ptr(p, raw_smp_processor_id())

2012-11-01 Thread Shan Wei
Paul E. McKenney said, at 2012/11/1 4:08: > > One thing to keep in mind -- the only purpose of this is to diffuse > memory contention. So there is no need to disable preemption. same question to me. Christoph, maybe __this_cpu_read is a better choice which don't disable preemption. > >

Re: [PATCH 3/9] net: xfrm: use this_cpu_ptr per-cpu helper

2012-11-01 Thread Shan Wei
Herbert Xu said, at 2012/11/1 11:41: > Please refer to the comment in the patch above. > > But I think the patch is wrong anyway because it would introduce > a warning, no? yes, __this_cpu_ptr(or __this_cpu_read) is more reasonable which don't check preemption context. > > Thanks, > -- To un

Re: [PATCH 3/9] net: xfrm: use this_cpu_ptr per-cpu helper

2012-11-01 Thread Shan Wei
Christoph Lameter said, at 2012/11/1 1:35: > It would be better to use > > this_cpu_read(tfms) > > since that would also make it atomic vs interrupts. The above code (both > original and modified) could determine a pointer to a per cpu structure > and then take an interrupt which would move

Re: [PATCH 7/9] rcu: use this_cpu_ptr per-cpu helper instead of per_cpu_ptr(p, raw_smp_processor_id())

2012-10-31 Thread Shan Wei
Paul E. McKenney said, at 2012/10/31 19:51: > > The first uses smp_processor_id(), which will complain if > force_quiescent_state() is called with preemption disabled, which it > sometimes is. > > So what am I missing here? Hi Paul this patch is not right for CONFIG_DEBUG_PREEMPT case. __this_c

[PATCH 7/9] rcu: use this_cpu_ptr per-cpu helper instead of per_cpu_ptr(p, raw_smp_processor_id())

2012-10-31 Thread Shan Wei
From: Shan Wei smp_processor_id is defined as raw_smp_processor_id. replace per_cpu_ptr(p, raw_smp_processor_id()) is also ok. Signed-off-by: Shan Wei --- kernel/rcutree.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/rcutree.c b/kernel/rcutree.c index

[PATCH 9/9] clocksource: use this_cpu_ptr per-cpu helper

2012-10-31 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- drivers/clocksource/arm_generic.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/clocksource/arm_generic.c b/drivers/clocksource/arm_generic.c index c4d9f95..cb445ab 100644 --- a/drivers/clocksource/arm_generic.c

[PATCH 8/9] trace: use this_cpu_ptr per-cpu helper

2012-10-31 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- kernel/trace/blktrace.c |2 +- kernel/trace/trace.c|2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index c0bd030..71259e2 100644 --- a/kernel/trace/blktrace.c +++ b

[PATCH 6/9] kernel: padata : use this_cpu_ptr per-cpu helper

2012-10-31 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- kernel/padata.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/kernel/padata.c b/kernel/padata.c index 89fe3d1..70dffe8 100644 --- a/kernel/padata.c +++ b/kernel/padata.c @@ -204,7 +204,7 @@ static struct padata_priv

[PATCH 5/9] ftrace: use this_cpu_ptr per-cpu helper

2012-10-31 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- include/trace/ftrace.h |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index a763888..7c9fde7 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h @@ -638,7 +638,6

[PATCH 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper

2012-10-31 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- net/openvswitch/datapath.c |4 ++-- net/openvswitch/vport.c|5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index 4c4b62c..77d16a5 100644 --- a/net/openvswitch

[PATCH 3/9] net: xfrm: use this_cpu_ptr per-cpu helper

2012-10-31 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- net/xfrm/xfrm_ipcomp.c |7 +++ 1 files changed, 3 insertions(+), 4 deletions(-) diff --git a/net/xfrm/xfrm_ipcomp.c b/net/xfrm/xfrm_ipcomp.c index e5246fb..af6c78a 100644 --- a/net/xfrm/xfrm_ipcomp.c +++ b/net/xfrm/xfrm_ipcomp.c @@ -276,14

[PATCH 2/9] net: rds: use this_cpu_ptr per-cpu helper

2012-10-31 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- net/rds/ib_recv.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index 8d19491..a4a5064 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -423,7 +423,7 @@ static void

[PATCH 1/9] net: core: use this_cpu_ptr per-cpu helper

2012-10-31 Thread Shan Wei
From: Shan Wei Signed-off-by: Shan Wei --- net/core/flow.c |4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/net/core/flow.c b/net/core/flow.c index e318c7e..3bad824 100644 --- a/net/core/flow.c +++ b/net/core/flow.c @@ -327,11 +327,9 @@ static void

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

2012-10-31 Thread Shan Wei
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