Re: [PATCH net-next v2] net/sched: sch_dualpi2: annotate lockless stats reads in dump path
From: Eric Dumazet
Date: Thu May 14 2026 - 07:44:23 EST
On Fri, May 8, 2026 at 12:29 AM Vineet Agarwal
<agarwal.vineet2006@xxxxxxxxx> wrote:
>
> dualpi2_dump_stats() runs without holding the qdisc lock and provides
> best-effort statistics to userspace.
>
> These fields are updated concurrently from enqueue and dequeue paths
> and may be observed locklessly in the dump path.
>
> Use READ_ONCE() to ensure safe single-copy loads of these counters and
> prevent compiler optimizations that could otherwise result in torn or
> inconsistent observations on weakly ordered architectures.
>
> No WRITE_ONCE() annotations are added because these statistics are
> maintained as best-effort counters, and the update paths already use
> simple non-synchronized increments consistent with existing qdisc
> statistics patterns. The intent of this change is only to make the
> lockless read semantics explicit.
I missed this V2, sorry for the delay.
I think we can cook a more correct patch, with READ_ONCE() and WRITE_ONCE().
I will send it now.
Thanks.