Commit dd25296a authored by Yunsheng Lin's avatar Yunsheng Lin Committed by David S. Miller

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: default avatarJakub Kicinski <kuba@kernel.org>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com> # flexcan
Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 38f75922
...@@ -188,6 +188,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc) ...@@ -188,6 +188,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
nolock_empty: nolock_empty:
WRITE_ONCE(qdisc->empty, false); WRITE_ONCE(qdisc->empty, false);
return true;
} else if (qdisc_is_running(qdisc)) { } else if (qdisc_is_running(qdisc)) {
return false; return false;
} }
...@@ -201,7 +202,6 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc) ...@@ -201,7 +202,6 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
static inline void qdisc_run_end(struct Qdisc *qdisc) static inline void qdisc_run_end(struct Qdisc *qdisc)
{ {
write_seqcount_end(&qdisc->running);
if (qdisc->flags & TCQ_F_NOLOCK) { if (qdisc->flags & TCQ_F_NOLOCK) {
spin_unlock(&qdisc->seqlock); spin_unlock(&qdisc->seqlock);
...@@ -210,6 +210,8 @@ static inline void qdisc_run_end(struct Qdisc *qdisc) ...@@ -210,6 +210,8 @@ static inline void qdisc_run_end(struct Qdisc *qdisc)
clear_bit(__QDISC_STATE_MISSED, &qdisc->state); clear_bit(__QDISC_STATE_MISSED, &qdisc->state);
__netif_schedule(qdisc); __netif_schedule(qdisc);
} }
} else {
write_seqcount_end(&qdisc->running);
} }
} }
......
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