Ahmed S. Darwish 67c9e6270f net: sched: Protect Qdisc::bstats with u64_stats
The not-per-CPU variant of qdisc tc (traffic control) statistics,
Qdisc::gnet_stats_basic_packed bstats, is protected with Qdisc::running
sequence counter.

This sequence counter is used for reliably protecting bstats reads from
parallel writes. Meanwhile, the seqcount's write section covers a much
wider area than bstats update: qdisc_run_begin() => qdisc_run_end().

That read/write section asymmetry can lead to needless retries of the
read section. To prepare for removing the Qdisc::running sequence
counter altogether, introduce a u64_stats sync point inside bstats
instead.

Modify _bstats_update() to start/end the bstats u64_stats write
section.

For bisectability, and finer commits granularity, the bstats read
section is still protected with a Qdisc::running read/retry loop and
qdisc_run_begin/end() still starts/ends that seqcount write section.
Once all call sites are modified to use _bstats_update(), the
Qdisc::running seqcount will be removed and bstats read/retry loop will
be modified to utilize the internal u64_stats sync point.

Note, using u64_stats implies no sequence counter protection for 64-bit
architectures. This can lead to the statistics "packets" vs. "bytes"
values getting out of sync on rare occasions. The individual values will
still be valid.

[bigeasy: Minor commit message edits, init all gnet_stats_basic_packed.]

Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-10-18 12:54:41 +01:00
..
2021-07-01 13:19:48 -07:00
2021-06-11 13:32:46 -07:00
2021-10-13 09:40:45 -07:00
2021-08-03 11:50:22 +01:00
2021-10-13 09:40:46 -07:00
2021-10-13 09:40:46 -07:00
2021-07-29 12:18:11 +01:00
2020-05-05 13:23:29 -07:00
2019-12-09 10:36:44 -08:00
2020-06-22 21:12:44 -07:00
2021-10-15 11:33:08 +01:00
2021-07-27 20:11:44 +01:00
2021-09-30 14:17:10 +01:00
2021-03-30 13:29:39 -07:00
2021-10-13 09:40:46 -07:00
2021-07-27 13:05:56 +01:00
2021-10-13 09:40:46 -07:00
2021-09-29 11:00:11 +01:00
2021-09-29 11:00:11 +01:00
2021-09-18 14:20:00 +01:00
2019-12-09 10:36:44 -08:00
2021-10-13 09:40:46 -07:00
2020-03-04 13:25:55 -08:00
2021-05-17 15:29:35 -07:00
2021-10-13 09:40:45 -07:00
2021-08-04 10:01:26 +01:00
2019-04-22 21:47:25 -07:00
2019-10-05 16:29:00 -07:00
2021-08-03 13:05:26 +01:00
2021-09-28 13:26:23 +01:00
2020-06-18 20:46:23 -07:00
2019-12-09 10:28:43 -08:00
2021-09-28 00:18:35 +02:00