Commit e9be0e99 authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller

net: sched: shrink struct Qdisc

The struct Qdisc has a lot of holes, especially after commit
a53851e2 ("net: sched: explicit locking in gso_cpu fallback"),
which as a side effect, moved the fields just after 'busylock'
on a new cacheline.

Since both 'padded' and 'refcnt' are not updated frequently, and
there is a hole before 'gso_skb', we can move such fields there,
saving a cacheline without any performance side effect.

Before this commit:

pahole -C Qdisc net/sche/sch_generic.o
	# ...
        /* size: 384, cachelines: 6, members: 25 */
        /* sum members: 236, holes: 3, sum holes: 92 */
        /* padding: 56 */

After this commit:
pahole -C Qdisc net/sche/sch_generic.o
	# ...
	/* size: 320, cachelines: 5, members: 25 */
	/* sum members: 236, holes: 2, sum holes: 28 */
	/* padding: 56 */
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 102cd909
...@@ -85,6 +85,8 @@ struct Qdisc { ...@@ -85,6 +85,8 @@ struct Qdisc {
struct net_rate_estimator __rcu *rate_est; struct net_rate_estimator __rcu *rate_est;
struct gnet_stats_basic_cpu __percpu *cpu_bstats; struct gnet_stats_basic_cpu __percpu *cpu_bstats;
struct gnet_stats_queue __percpu *cpu_qstats; struct gnet_stats_queue __percpu *cpu_qstats;
int padded;
refcount_t refcnt;
/* /*
* For performance sake on SMP, we put highly modified fields at the end * For performance sake on SMP, we put highly modified fields at the end
...@@ -97,8 +99,6 @@ struct Qdisc { ...@@ -97,8 +99,6 @@ struct Qdisc {
unsigned long state; unsigned long state;
struct Qdisc *next_sched; struct Qdisc *next_sched;
struct sk_buff_head skb_bad_txq; struct sk_buff_head skb_bad_txq;
int padded;
refcount_t refcnt;
spinlock_t busylock ____cacheline_aligned_in_smp; spinlock_t busylock ____cacheline_aligned_in_smp;
spinlock_t seqlock; spinlock_t seqlock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment