* [PATCH v4 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper
@ 2012-11-13 1:52 Shan Wei
2012-11-16 8:35 ` Shan Wei
0 siblings, 1 reply; 3+ messages in thread
From: Shan Wei @ 2012-11-13 1:52 UTC (permalink / raw)
To: jesse, dev, NetDev, Kernel-Maillist, David Miller, cl, Shan Wei
From: Shan Wei <davidshan@tencent.com>
just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id());
Signed-off-by: Shan Wei <davidshan@tencent.com>
Reviewed-by: Christoph Lameter <cl@linux.com>
---
no changes vs v3,v2.
---
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/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_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++;
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 03779e8..70af0be 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -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++;
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper
2012-11-13 1:52 [PATCH v4 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper Shan Wei
@ 2012-11-16 8:35 ` Shan Wei
2012-11-16 21:53 ` Jesse Gross
0 siblings, 1 reply; 3+ messages in thread
From: Shan Wei @ 2012-11-16 8:35 UTC (permalink / raw)
To: jesse; +Cc: Shan Wei, dev, NetDev, Kernel-Maillist, David Miller, cl, Tejun Heo
Shan Wei said, at 2012/11/13 9:52:
> From: Shan Wei <davidshan@tencent.com>
>
> just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id());
>
>
> Signed-off-by: Shan Wei <davidshan@tencent.com>
> Reviewed-by: Christoph Lameter <cl@linux.com>
Jesse Gross, would you like to pick it up to your tree?
> ---
> no changes vs v3,v2.
> ---
> 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/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_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++;
> diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
> index 03779e8..70af0be 100644
> --- a/net/openvswitch/vport.c
> +++ b/net/openvswitch/vport.c
> @@ -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++;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v4 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper
2012-11-16 8:35 ` Shan Wei
@ 2012-11-16 21:53 ` Jesse Gross
0 siblings, 0 replies; 3+ messages in thread
From: Jesse Gross @ 2012-11-16 21:53 UTC (permalink / raw)
To: Shan Wei; +Cc: dev, NetDev, Kernel-Maillist, David Miller, cl, Tejun Heo
On Fri, Nov 16, 2012 at 12:35 AM, Shan Wei <shanwei88@gmail.com> wrote:
> Shan Wei said, at 2012/11/13 9:52:
>> From: Shan Wei <davidshan@tencent.com>
>>
>> just use more faster this_cpu_ptr instead of per_cpu_ptr(p, smp_processor_id());
>>
>>
>> Signed-off-by: Shan Wei <davidshan@tencent.com>
>> Reviewed-by: Christoph Lameter <cl@linux.com>
>
> Jesse Gross, would you like to pick it up to your tree?
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-16 21:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-13 1:52 [PATCH v4 4/9] net: openvswitch: use this_cpu_ptr per-cpu helper Shan Wei
2012-11-16 8:35 ` Shan Wei
2012-11-16 21:53 ` Jesse Gross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).