net: openvswitch: use this_cpu_ptr per-cpu helper
Subsystems (3)
PATCH v4 4/9 net: openvswitch: use this_cpu_ptr per-cpu helper
From: Shan Wei <[email protected]>
just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id());
Signed-off-by Shan Wei <[email protected]>
Reviewed-by Christoph Lameter <[email protected]>
---
no changes vs v3,v2.
--- net/openvswitch/datapath.c | 4 ++-- net/openvswitch/vport.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-)
net/openvswitch/datapath.c +2 -2
@@ -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 =this_cpu_ptr (dp->stats_percpu);/* Extract flow from 'skb' into 'key'. */ error =ovs_flow_extract (skb, p->port_no, &key, &key_len);
@@ -282,7 +282,7 @@ int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb,return 0 ; err: - stats =per_cpu_ptr (dp->stats_percpu,smp_processor_id ()); + stats =this_cpu_ptr (dp->stats_percpu);u64_stats_update_begin (&stats->sync); stats->n_lost++;
net/openvswitch/vport.c +2 -3
@@ -333,8 +333,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb) {struct vport_percpu_stats *stats; - stats =per_cpu_ptr (vport->percpu_stats,smp_processor_id ()); - + stats =this_cpu_ptr (vport->percpu_stats);u64_stats_update_begin (&stats->sync); stats->rx_packets++; stats->rx_bytes += skb->len;
@@ -359,7 +358,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)if (likely (sent)) {struct vport_percpu_stats *stats; - stats =per_cpu_ptr (vport->percpu_stats,smp_processor_id ()); + stats =this_cpu_ptr (vport->percpu_stats);u64_stats_update_begin (&stats->sync); stats->tx_packets++;
Signature · 1 line
1.7.1
Shan Wei said, at 2012/11/13 9:52:
Quoted 7 lines
From: Shan Wei <[email protected]>
just use more faster
this_cpu_ptrinstead ofper_cpu_ptr(p, smp_processor_id());Signed-off-by Shan Wei <[email protected]>Reviewed-by Christoph Lameter <[email protected]>
Jesse Gross, would you like to pick it up to your tree?
Quoted 53 lines
---
no changes vs v3,v2.--- net/openvswitch/datapath.c | 4 ++-- net/openvswitch/vport.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-)net/openvswitch/datapath.c +2
-2@@ -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 =this_cpu_ptr (dp->stats_percpu);/* Extract flow from 'skb' into 'key'. */ error =ovs_flow_extract (skb, p->port_no, &key, &key_len);@@ -282,7 +282,7 @@ int ovs_dp_upcall(struct datapath *dp, struct sk_buff *skb,return 0 ; err: - stats =per_cpu_ptr (dp->stats_percpu,smp_processor_id ()); + stats =this_cpu_ptr (dp->stats_percpu);u64_stats_update_begin (&stats->sync); stats->n_lost++;net/openvswitch/vport.c +2
-3@@ -333,8 +333,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff *skb) {struct vport_percpu_stats *stats; - stats =per_cpu_ptr (vport->percpu_stats,smp_processor_id ()); - + stats =this_cpu_ptr (vport->percpu_stats);u64_stats_update_begin (&stats->sync); stats->rx_packets++; stats->rx_bytes += skb->len;@@ -359,7 +358,7 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)if (likely (sent)) {struct vport_percpu_stats *stats; - stats =per_cpu_ptr (vport->percpu_stats,smp_processor_id ()); + stats =this_cpu_ptr (vport->percpu_stats);u64_stats_update_begin (&stats->sync); stats->tx_packets++;
Jesse Gross
AppliedQuoted 10 lines · Shan Wei
Shan Wei said, at 2012/11/13 9:52:
Quoted 7 lines
From: Shan Wei <[email protected]>
just use more faster
this_cpu_ptrinstead ofper_cpu_ptr(p, smp_processor_id());Signed-off-by Shan Wei <[email protected]>Reviewed-by Christoph Lameter <[email protected]>Jesse Gross, would you like to pick it up to your tree?
Applied, thanks.