diff options
author | Yunsheng Lin <linyunsheng@huawei.com> | 2021-06-22 14:49:55 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-06-23 12:17:35 -0700 |
commit | dd25296afaf60b5140ddfa9e3d8e5d9df7076754 (patch) | |
tree | b40d4c10c3406f24480ee664c88f138aa1e3b569 /include/net/sch_generic.h | |
parent | 38f75922a6905b010f597fc70dbb5db28398728e (diff) | |
download | lwn-dd25296afaf60b5140ddfa9e3d8e5d9df7076754.tar.gz lwn-dd25296afaf60b5140ddfa9e3d8e5d9df7076754.zip |
net: sched: avoid unnecessary seqcount operation for lockless qdisc
qdisc->running seqcount operation is mainly used to do heuristic
locking on q->busylock for locked qdisc, see qdisc_is_running()
and __dev_xmit_skb().
So avoid doing seqcount operation for qdisc with TCQ_F_NOLOCK
flag.
Acked-by: Jakub Kicinski <kuba@kernel.org>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> # flexcan
Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r-- | include/net/sch_generic.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 1e625519ae96..3ed6bcc4be72 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -188,6 +188,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc) nolock_empty: WRITE_ONCE(qdisc->empty, false); + return true; } else if (qdisc_is_running(qdisc)) { return false; } @@ -201,7 +202,6 @@ nolock_empty: static inline void qdisc_run_end(struct Qdisc *qdisc) { - write_seqcount_end(&qdisc->running); if (qdisc->flags & TCQ_F_NOLOCK) { spin_unlock(&qdisc->seqlock); @@ -210,6 +210,8 @@ static inline void qdisc_run_end(struct Qdisc *qdisc) clear_bit(__QDISC_STATE_MISSED, &qdisc->state); __netif_schedule(qdisc); } + } else { + write_seqcount_end(&qdisc->running); } } |