mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
net/sched: add qdisc_qlen_lockless() helper
Used in contexts were qdisc spinlock is not held. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk> Link: https://patch.msgid.link/20260510091455.4039245-5-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
0e5b05f44d
commit
554e96a47a
|
|
@ -542,6 +542,11 @@ static inline int qdisc_qlen(const struct Qdisc *q)
|
|||
return q->q.qlen;
|
||||
}
|
||||
|
||||
static inline int qdisc_qlen_lockless(const struct Qdisc *q)
|
||||
{
|
||||
return READ_ONCE(q->q.qlen);
|
||||
}
|
||||
|
||||
static inline void qdisc_qlen_inc(struct Qdisc *q)
|
||||
{
|
||||
WRITE_ONCE(q->q.qlen, q->q.qlen + 1);
|
||||
|
|
@ -561,7 +566,7 @@ static inline int qdisc_qlen_sum(const struct Qdisc *q)
|
|||
for_each_possible_cpu(i)
|
||||
qlen += READ_ONCE(per_cpu_ptr(q->cpu_qstats, i)->qlen);
|
||||
} else {
|
||||
qlen += READ_ONCE(q->q.qlen);
|
||||
qlen += qdisc_qlen_lockless(q);
|
||||
}
|
||||
|
||||
return qlen;
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ void mq_dump_common(struct Qdisc *sch, struct sk_buff *skb)
|
|||
&qdisc->bstats, false);
|
||||
gnet_stats_add_queue(&sch->qstats, qdisc->cpu_qstats,
|
||||
&qdisc->qstats);
|
||||
qlen += qdisc_qlen(qdisc);
|
||||
qlen += qdisc_qlen_lockless(qdisc);
|
||||
|
||||
spin_unlock_bh(qdisc_lock(qdisc));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -576,7 +576,7 @@ static int mqprio_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||
&qdisc->bstats, false);
|
||||
gnet_stats_add_queue(&sch->qstats, qdisc->cpu_qstats,
|
||||
&qdisc->qstats);
|
||||
qlen += qdisc_qlen(qdisc);
|
||||
qlen += qdisc_qlen_lockless(qdisc);
|
||||
|
||||
spin_unlock_bh(qdisc_lock(qdisc));
|
||||
}
|
||||
|
|
@ -691,7 +691,7 @@ static int mqprio_dump_class_stats(struct Qdisc *sch, unsigned long cl,
|
|||
&qdisc->bstats, false);
|
||||
gnet_stats_add_queue(&qstats, qdisc->cpu_qstats,
|
||||
&qdisc->qstats);
|
||||
qlen += qdisc_qlen(qdisc);
|
||||
qlen += qdisc_qlen_lockless(qdisc);
|
||||
|
||||
spin_unlock_bh(qdisc_lock(qdisc));
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user