Re: [ovs-dev] [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++; >>> >>> Use this_cpu_inc(vport->percpu_stats->packets) here? >> >> Lots of net

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

2012-11-08 Thread Christoph Lameter
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++; > > > > Use this_cpu_inc(vport->percpu_stats->packets) here? > > Lots of network drivers use u64_stats_sync infrastructure for

Re: [ovs-dev] [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: [ovs-dev] [PATCH 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper

2012-11-02 Thread Christoph Lameter
On Sat, 3 Nov 2012, Shan Wei wrote: > +++ b/net/openvswitch/datapath.c > @@ -208,7 +208,7 @@ void ovs_dp_process_received_packet(struct vport *p, > struct sk_buff *skb) > int error; > int key_len; > > - stats = per_cpu_ptr(dp->stats_percpu, smp_processor_id()); > + stats = thi

[ovs-dev] [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 --- net/openvswitch/d

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

2012-11-02 Thread Christoph Lameter
On Thu, 1 Nov 2012, Jesse Gross wrote: > On Thu, Nov 1, 2012 at 7:33 AM, Christoph Lameter wrote: > > On Thu, 1 Nov 2012, Shan Wei wrote: > > > >> But for different field in same per-cpu variable, how to guarantee n_missed > >> and n_hit are from same cpu? > >> this_cpu_read(dp->stats_percpu->n_m

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

2012-11-01 Thread Jesse Gross
On Thu, Nov 1, 2012 at 7:33 AM, Christoph Lameter wrote: > On Thu, 1 Nov 2012, Shan Wei wrote: > >> But for different field in same per-cpu variable, how to guarantee n_missed >> and n_hit are from same cpu? >> this_cpu_read(dp->stats_percpu->n_missed); >> [processor changed] >> this_cpu_read(dp->

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

2012-11-01 Thread 单卫
2012/11/1 Christoph Lameter > > > 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. > > Thanks very much, I will resubmit new patchset.

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

2012-11-01 Thread Christoph Lameter
On Thu, 1 Nov 2012, Shan Wei wrote: > But for different field in same per-cpu variable, how to guarantee n_missed > and n_hit are from same cpu? > this_cpu_read(dp->stats_percpu->n_missed); > [processor changed] > this_cpu_read(dp->stats_percpu->n_hit); What does current guarantee that? If it is

Re: [ovs-dev] [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) >> int error; >> int key_len; >

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

2012-10-31 Thread Christoph Lameter
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) > int error; > int key_len; > > - stats = per_cpu_ptr(dp->stats_percpu, smp_

[ovs-dev] [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/