]> git.baikalelectronics.ru Git - kernel.git/commit
net: get rid of spin_trylock() in net_tx_action()
authorEric Dumazet <edumazet@google.com>
Sun, 5 Jun 2016 03:02:28 +0000 (20:02 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Jun 2016 22:32:03 +0000 (15:32 -0700)
commit813db8dadea6674f943ceb939b8f4f4f2ad7a749
treef254ad9c90e933e27376f976b7159eb62b7b3134
parent47e7c3e54d6dd99473aed423942b52df79bf3d5c
net: get rid of spin_trylock() in net_tx_action()

Note: Tom Herbert posted almost same patch 3 months back, but for
different reasons.

The reasons we want to get rid of this spin_trylock() are :

1) Under high qdisc pressure, the spin_trylock() has almost no
chance to succeed.

2) We loop multiple times in softirq handler, eventually reaching
the max retry count (10), and we schedule ksoftirqd.

Since we want to adhere more strictly to ksoftirqd being waked up in
the future (https://lwn.net/Articles/687617/), better avoid spurious
wakeups.

3) calls to __netif_reschedule() dirty the cache line containing
q->next_sched, slowing down the owner of qdisc.

4) RT kernels can not use the spin_trylock() here.

With help of busylock, we get the qdisc spinlock fast enough, and
the trylock trick brings only performance penalty.

Depending on qdisc setup, I observed a gain of up to 19 % in qdisc
performance (1016600 pps instead of 853400 pps, using prio+tbf+fq_codel)

("mpstat -I SCPU 1" is much happier now)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Tom Herbert <tom@herbertland.com>
Acked-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c