path: root/net/sched/sch_generic.c
diff options
authorPaolo Abeni <>2019-03-22 16:01:55 +0100
committerDavid S. Miller <>2019-03-23 21:52:36 -0400
commit28cff537ef2eed9307bc7e4e40745075637bec56 (patch)
tree19e12fe1c09bd817cae2410b5dd0b68ff6c21e43 /net/sched/sch_generic.c
parent576fd2f7cac3daa36025f0039f9e7cb75b4b4ae0 (diff)
net: sched: add empty status flag for NOLOCK qdisc
The queue is marked not empty after acquiring the seqlock, and it's up to the NOLOCK qdisc clearing such flag on dequeue. Since the empty status lays on the same cache-line of the seqlock, it's always hot on cache during the updates. This makes the empty flag update a little bit loosy. Given the lack of synchronization between enqueue and dequeue, this is unavoidable. v2 -> v3: - qdisc_is_empty() has a const argument (Eric) v1 -> v2: - use really an 'empty' flag instead of 'not_empty', as suggested by Eric Signed-off-by: Paolo Abeni <> Reviewed-by: Eric Dumazet <> Reviewed-by: Ivan Vecera <> Signed-off-by: David S. Miller <>
Diffstat (limited to 'net/sched/sch_generic.c')
1 files changed, 3 insertions, 0 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index a117d9260558..81356ef38d1d 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -671,6 +671,8 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
qdisc_qstats_cpu_backlog_dec(qdisc, skb);
qdisc_bstats_cpu_update(qdisc, skb);
+ } else {
+ qdisc->empty = true;
return skb;
@@ -880,6 +882,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
sch->enqueue = ops->enqueue;
sch->dequeue = ops->dequeue;
sch->dev_queue = dev_queue;
+ sch->empty = true;
refcount_set(&sch->refcnt, 1);