Re: [PATCH v2 2/5] sched_ext: Manage the validity of scx_rq_clock

From: Changwoo Min
Date: Mon Dec 02 2024 - 09:56:55 EST


Hello Peter,

On 24. 12. 2. 18:58, Peter Zijlstra wrote:
On Mon, Dec 02, 2024 at 01:38:46PM +0900, Changwoo Min wrote:
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 95e40895a519..ab8015c8cab4 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -789,6 +789,7 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
void update_rq_clock(struct rq *rq)
{
s64 delta;
+ u64 clock;
lockdep_assert_rq_held(rq);
@@ -800,11 +801,14 @@ void update_rq_clock(struct rq *rq)
SCHED_WARN_ON(rq->clock_update_flags & RQCF_UPDATED);
rq->clock_update_flags |= RQCF_UPDATED;
#endif
+ clock = sched_clock_cpu(cpu_of(rq));
+ scx_rq_clock_update(rq, clock);

This adds a write to a second cacheline for *everyone* always.

Please don't do that.


Thank you for the suggestion! I will update the flags only when
the scx is enabled by checking it inside the
scx_rq_clock_update() and scx_rq_clock_stale() functions.

Regards,
Changwoo Min