Skip to contentSkip to conversation

Revert "sched_ext: Use READ_ONCE() for the read side of dsq->nr update"

PATCH New Tejun Heo 1 participant 1 message Mar 8

Subsystems (2)
lore
Share & tools
lore

Tejun Heo

author reviewer
#0 lore raw

PATCH 1/1 Revert "sched_ext: Use READ_ONCE() for the read side of dsq->nr update"

From 80a54b807d6c0b98e43522f102da61c953cfd502 Mon Sep 17 00:00:00 2001

This reverts commit 9adfcef334bf9c6ef68eaecfca5f45d18614efe0.

dsq->nr is protected by dsq->lock and reading while holding the lock doesn't constitute a racy read.

---
Committed to sched_ext/for-7.1.

Please provide positive KCSAN output on future READ/WRITE_ONCE() submissions.

Thanks.

 kernel/sched/ext.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
kernel/sched/ext.c +2 -6
index f6bafcfe0b93..d6d807337013 100644
@@ -1296,12 +1296,8 @@ static bool scx_dsq_priq_less(struct rb_node *node_a,
 
 static void dsq_mod_nr(struct scx_dispatch_q *dsq, s32 delta)
 {
-	/*
-	 * scx_bpf_dsq_nr_queued() reads ->nr without locking. Use READ_ONCE()
-	 * on the read side and WRITE_ONCE() on the write side to properly
-	 * annotate the concurrent lockless access and avoid KCSAN warnings.
-	 */
-	WRITE_ONCE(dsq->nr, READ_ONCE(dsq->nr) + delta);
+	/* scx_bpf_dsq_nr_queued() reads ->nr without locking, use WRITE_ONCE() */
+	WRITE_ONCE(dsq->nr, dsq->nr + delta);
 }
 
 static void refill_task_slice_dfl(struct scx_sched *sch, struct task_struct *p)
Signature · 1 line
2.53.0