Re: [PATCH sched_ext/for-7.3-fixes] sched_ext: Generate qseq from a per-task counter
From: Tejun Heo
Date: Fri Oct 02 2026 - 18:33:31 EST
Hello, Kuba.
On Fri, Oct 02, 2026 at 08:52:41PM +0000, Kuba Piecuch wrote:
> + do {
> + p->scx.ops_qseq++;
> + qseq = (unsigned long)p->scx.ops_qseq << SCX_OPSS_QSEQ_SHIFT;
> + } while (unlikely(!qseq));
Maybe wrap the counter where the QSEQ field wraps instead of looping?
p->scx.ops_qseq = ((p->scx.ops_qseq + 1) &
(SCX_OPSS_QSEQ_MASK >> SCX_OPSS_QSEQ_SHIFT)) ?: 1;
qseq = (unsigned long)p->scx.ops_qseq << SCX_OPSS_QSEQ_SHIFT;
On 32bit, the shift drops the top two bits of the counter, so the mask is
what keeps the counter from reaching a value that shifts to 0.
Thanks.
--
tejun