mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 02:59:05 -04:00
Merge branch 'net-sched-changes-around-qdisc_qstats_qlen_backlog'
Eric Dumazet says: ==================== net/sched: changes around qdisc_qstats_qlen_backlog() First patch makes clear qdisc_qstats_qlen_backlog() runs locklessly. Second patch changes ioam6 to not acquire qdisc spinlock anymore. Third pach adds missing READ_ONCE()/WRITE_ONCE() annotations in hfsc. htb still needs fixes, I will take care of them separately. ==================== Link: https://patch.msgid.link/20260513080853.1383975-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -1070,13 +1070,13 @@ static inline int qdisc_qstats_copy(struct gnet_dump *d, const struct Qdisc *sch
|
||||
return gnet_stats_copy_queue(d, sch->cpu_qstats, &sch->qstats, qlen);
|
||||
}
|
||||
|
||||
static inline void qdisc_qstats_qlen_backlog(struct Qdisc *sch, __u32 *qlen,
|
||||
__u32 *backlog)
|
||||
static inline void qdisc_qstats_qlen_backlog(const struct Qdisc *sch,
|
||||
u32 *qlen, u32 *backlog)
|
||||
{
|
||||
struct gnet_stats_queue qstats = { 0 };
|
||||
|
||||
gnet_stats_add_queue(&qstats, sch->cpu_qstats, &sch->qstats);
|
||||
*qlen = qstats.qlen + qdisc_qlen(sch);
|
||||
*qlen = qstats.qlen + qdisc_qlen_lockless(sch);
|
||||
*backlog = qstats.backlog;
|
||||
}
|
||||
|
||||
|
||||
@@ -800,7 +800,7 @@ static void __ioam6_fill_trace_data(struct sk_buff *skb,
|
||||
/* queue depth */
|
||||
if (trace->type.bit6) {
|
||||
struct netdev_queue *queue;
|
||||
struct Qdisc *qdisc;
|
||||
const struct Qdisc *qdisc;
|
||||
__u32 qlen, backlog;
|
||||
|
||||
if (dev->flags & IFF_LOOPBACK ||
|
||||
@@ -810,9 +810,7 @@ static void __ioam6_fill_trace_data(struct sk_buff *skb,
|
||||
queue = skb_get_tx_queue(dev, skb);
|
||||
qdisc = rcu_dereference(queue->qdisc);
|
||||
|
||||
spin_lock_bh(qdisc_lock(qdisc));
|
||||
qdisc_qstats_qlen_backlog(qdisc, &qlen, &backlog);
|
||||
spin_unlock_bh(qdisc_lock(qdisc));
|
||||
|
||||
*(__be32 *)data = cpu_to_be32(backlog);
|
||||
}
|
||||
|
||||
@@ -715,7 +715,7 @@ init_vf(struct hfsc_class *cl, unsigned int len)
|
||||
rtsc_min(&cl->cl_virtual, &cl->cl_fsc, cl->cl_vt, cl->cl_total);
|
||||
cl->cl_vtadj = 0;
|
||||
|
||||
cl->cl_vtperiod++; /* increment vt period */
|
||||
WRITE_ONCE(cl->cl_vtperiod, cl->cl_vtperiod + 1); /* increment vt period */
|
||||
cl->cl_parentperiod = cl->cl_parent->cl_vtperiod;
|
||||
if (cl->cl_parent->cl_nactive == 0)
|
||||
cl->cl_parentperiod++;
|
||||
@@ -757,7 +757,7 @@ update_vf(struct hfsc_class *cl, unsigned int len, u64 cur_time)
|
||||
go_passive = 1;
|
||||
|
||||
for (; cl->cl_parent != NULL; cl = cl->cl_parent) {
|
||||
cl->cl_total += len;
|
||||
WRITE_ONCE(cl->cl_total, cl->cl_total + len);
|
||||
|
||||
if (!(cl->cl_flags & HFSC_FSC) || cl->cl_nactive == 0)
|
||||
continue;
|
||||
@@ -847,7 +847,7 @@ hfsc_adjust_levels(struct hfsc_class *cl)
|
||||
if (p->level >= level)
|
||||
level = p->level + 1;
|
||||
}
|
||||
cl->level = level;
|
||||
WRITE_ONCE(cl->level, level);
|
||||
} while ((cl = cl->cl_parent) != NULL);
|
||||
}
|
||||
|
||||
@@ -1338,10 +1338,10 @@ hfsc_dump_class_stats(struct Qdisc *sch, unsigned long arg,
|
||||
__u32 qlen;
|
||||
|
||||
qdisc_qstats_qlen_backlog(cl->qdisc, &qlen, &cl->qstats.backlog);
|
||||
xstats.level = cl->level;
|
||||
xstats.period = cl->cl_vtperiod;
|
||||
xstats.work = cl->cl_total;
|
||||
xstats.rtwork = cl->cl_cumul;
|
||||
xstats.level = READ_ONCE(cl->level);
|
||||
xstats.period = READ_ONCE(cl->cl_vtperiod);
|
||||
xstats.work = READ_ONCE(cl->cl_total);
|
||||
xstats.rtwork = READ_ONCE(cl->cl_cumul);
|
||||
|
||||
if (gnet_stats_copy_basic(d, NULL, &cl->bstats, true) < 0 ||
|
||||
gnet_stats_copy_rate_est(d, &cl->rate_est) < 0 ||
|
||||
@@ -1452,15 +1452,15 @@ hfsc_change_qdisc(struct Qdisc *sch, struct nlattr *opt,
|
||||
static void
|
||||
hfsc_reset_class(struct hfsc_class *cl)
|
||||
{
|
||||
cl->cl_total = 0;
|
||||
cl->cl_cumul = 0;
|
||||
WRITE_ONCE(cl->cl_total, 0);
|
||||
WRITE_ONCE(cl->cl_cumul, 0);
|
||||
cl->cl_d = 0;
|
||||
cl->cl_e = 0;
|
||||
cl->cl_vt = 0;
|
||||
cl->cl_vtadj = 0;
|
||||
cl->cl_cvtmin = 0;
|
||||
cl->cl_cvtoff = 0;
|
||||
cl->cl_vtperiod = 0;
|
||||
WRITE_ONCE(cl->cl_vtperiod, 0);
|
||||
cl->cl_parentperiod = 0;
|
||||
cl->cl_f = 0;
|
||||
cl->cl_myf = 0;
|
||||
@@ -1626,7 +1626,7 @@ hfsc_dequeue(struct Qdisc *sch)
|
||||
bstats_update(&cl->bstats, skb);
|
||||
update_vf(cl, qdisc_pkt_len(skb), cur_time);
|
||||
if (realtime)
|
||||
cl->cl_cumul += qdisc_pkt_len(skb);
|
||||
WRITE_ONCE(cl->cl_cumul, cl->cl_cumul + qdisc_pkt_len(skb));
|
||||
|
||||
if (cl->cl_flags & HFSC_RSC) {
|
||||
if (cl->qdisc->q.qlen != 0) {
|
||||
|
||||
Reference in New Issue
Block a user