* [PATCH net-next] net: minor optimization in qdisc_qstats_cpu_drop()
@ 2016-08-24 17:23 Eric Dumazet
2016-08-24 18:00 ` John Fastabend
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Eric Dumazet @ 2016-08-24 17:23 UTC (permalink / raw)
To: David Miller; +Cc: netdev, John Fastabend
From: Eric Dumazet <edumazet@google.com>
per_cpu_inc() is faster (at least on x86) than per_cpu_ptr(xxx)++;
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/net/sch_generic.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 0d501779cc68f9426e58da6d039dd64adc937c20..52a2015667b49c8315edbb26513a98d4c677fee5 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -592,7 +592,7 @@ static inline void qdisc_qstats_drop(struct Qdisc *sch)
static inline void qdisc_qstats_cpu_drop(struct Qdisc *sch)
{
- qstats_drop_inc(this_cpu_ptr(sch->cpu_qstats));
+ this_cpu_inc(sch->cpu_qstats->drops);
}
static inline void qdisc_qstats_overlimit(struct Qdisc *sch)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: minor optimization in qdisc_qstats_cpu_drop()
2016-08-24 17:23 [PATCH net-next] net: minor optimization in qdisc_qstats_cpu_drop() Eric Dumazet
@ 2016-08-24 18:00 ` John Fastabend
2016-08-24 19:13 ` Eric Dumazet
2016-08-24 18:04 ` Rick Jones
2016-08-25 23:45 ` David Miller
2 siblings, 1 reply; 6+ messages in thread
From: John Fastabend @ 2016-08-24 18:00 UTC (permalink / raw)
To: Eric Dumazet, David Miller; +Cc: netdev, John Fastabend
On 16-08-24 10:23 AM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> per_cpu_inc() is faster (at least on x86) than per_cpu_ptr(xxx)++;
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> include/net/sch_generic.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
> index 0d501779cc68f9426e58da6d039dd64adc937c20..52a2015667b49c8315edbb26513a98d4c677fee5 100644
> --- a/include/net/sch_generic.h
> +++ b/include/net/sch_generic.h
> @@ -592,7 +592,7 @@ static inline void qdisc_qstats_drop(struct Qdisc *sch)
>
> static inline void qdisc_qstats_cpu_drop(struct Qdisc *sch)
> {
> - qstats_drop_inc(this_cpu_ptr(sch->cpu_qstats));
> + this_cpu_inc(sch->cpu_qstats->drops);
> }
>
> static inline void qdisc_qstats_overlimit(struct Qdisc *sch)
>
>
Looks good to me. I guess we can also do the same for overlimit qstats.
Acked-by: John Fastabend <john.r.fastabend@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: minor optimization in qdisc_qstats_cpu_drop()
2016-08-24 17:23 [PATCH net-next] net: minor optimization in qdisc_qstats_cpu_drop() Eric Dumazet
2016-08-24 18:00 ` John Fastabend
@ 2016-08-24 18:04 ` Rick Jones
2016-08-24 19:07 ` Eric Dumazet
2016-08-25 23:45 ` David Miller
2 siblings, 1 reply; 6+ messages in thread
From: Rick Jones @ 2016-08-24 18:04 UTC (permalink / raw)
To: Eric Dumazet, David Miller; +Cc: netdev, John Fastabend
On 08/24/2016 10:23 AM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> per_cpu_inc() is faster (at least on x86) than per_cpu_ptr(xxx)++;
Is it possible it is non-trivially slower on other architectures?
rick jones
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> include/net/sch_generic.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
> index 0d501779cc68f9426e58da6d039dd64adc937c20..52a2015667b49c8315edbb26513a98d4c677fee5 100644
> --- a/include/net/sch_generic.h
> +++ b/include/net/sch_generic.h
> @@ -592,7 +592,7 @@ static inline void qdisc_qstats_drop(struct Qdisc *sch)
>
> static inline void qdisc_qstats_cpu_drop(struct Qdisc *sch)
> {
> - qstats_drop_inc(this_cpu_ptr(sch->cpu_qstats));
> + this_cpu_inc(sch->cpu_qstats->drops);
> }
>
> static inline void qdisc_qstats_overlimit(struct Qdisc *sch)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: minor optimization in qdisc_qstats_cpu_drop()
2016-08-24 18:04 ` Rick Jones
@ 2016-08-24 19:07 ` Eric Dumazet
0 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2016-08-24 19:07 UTC (permalink / raw)
To: Rick Jones; +Cc: David Miller, netdev, John Fastabend
On Wed, 2016-08-24 at 11:04 -0700, Rick Jones wrote:
> On 08/24/2016 10:23 AM, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@google.com>
> >
> > per_cpu_inc() is faster (at least on x86) than per_cpu_ptr(xxx)++;
>
> Is it possible it is non-trivially slower on other architectures?
No, in the worst case, compiler would emit the same code.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: minor optimization in qdisc_qstats_cpu_drop()
2016-08-24 18:00 ` John Fastabend
@ 2016-08-24 19:13 ` Eric Dumazet
0 siblings, 0 replies; 6+ messages in thread
From: Eric Dumazet @ 2016-08-24 19:13 UTC (permalink / raw)
To: John Fastabend; +Cc: David Miller, netdev, John Fastabend
On Wed, 2016-08-24 at 11:00 -0700, John Fastabend wrote:
> Looks good to me. I guess we can also do the same for overlimit qstats.
>
> Acked-by: John Fastabend <john.r.fastabend@intel.com>
Not sure about overlimit, although I could probably change these :
net/sched/act_bpf.c:85: qstats_drop_inc(this_cpu_ptr(prog->common.cpu_qstats));
net/sched/act_gact.c:145: qstats_drop_inc(this_cpu_ptr(gact->common.cpu_qstats));
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next] net: minor optimization in qdisc_qstats_cpu_drop()
2016-08-24 17:23 [PATCH net-next] net: minor optimization in qdisc_qstats_cpu_drop() Eric Dumazet
2016-08-24 18:00 ` John Fastabend
2016-08-24 18:04 ` Rick Jones
@ 2016-08-25 23:45 ` David Miller
2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-08-25 23:45 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, john.r.fastabend
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 24 Aug 2016 10:23:34 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> per_cpu_inc() is faster (at least on x86) than per_cpu_ptr(xxx)++;
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-08-25 23:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-24 17:23 [PATCH net-next] net: minor optimization in qdisc_qstats_cpu_drop() Eric Dumazet
2016-08-24 18:00 ` John Fastabend
2016-08-24 19:13 ` Eric Dumazet
2016-08-24 18:04 ` Rick Jones
2016-08-24 19:07 ` Eric Dumazet
2016-08-25 23:45 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.