[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5eeef2e1-7dc4-4aa8-8be4-c6e0fc2b5267@igalia.com>
Date: Fri, 27 Dec 2024 09:38:37 +0900
From: Changwoo Min <changwoo@...lia.com>
To: Tejun Heo <tj@...nel.org>, Changwoo Min <multics69@...il.com>
Cc: void@...ifault.com, arighi@...dia.com, mingo@...hat.com,
peterz@...radead.org, kernel-dev@...lia.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 2/6] sched_ext: Implement scx_bpf_now_ns()
Hello,
On 24. 12. 25. 06:47, Tejun Heo wrote:
> Hello,
>
> On Fri, Dec 20, 2024 at 03:20:21PM +0900, Changwoo Min wrote:
> ...
>> +__bpf_kfunc u64 scx_bpf_now_ns(void)
>
> Given that the default time unit is ns for the scheduler, the _ns suffix
> can probably go.
Ok. I will change is as suggested.
>
>> + if (!(READ_ONCE(rq->scx.flags) & SCX_RQ_CLK_VALID)) {
>> + clock = sched_clock_cpu(cpu_of(rq));
>> +
>> + /*
>> + * The rq clock is updated outside of the rq lock.
>> + * In this case, keep the updated rq clock invalid so the next
>> + * kfunc call outside the rq lock gets a fresh rq clock.
>> + */
>> + scx_rq_clock_update(rq, clock, false);
>
> Hmm... what does this update do?
It can be dropped as we do not track prev_clock.
> ...
>> +static inline void scx_rq_clock_update(struct rq *rq, u64 clock, bool valid)
>> +{
>> + if (!scx_enabled())
>> + return;
>> + WRITE_ONCE(rq->scx.clock, clock);
>> + if (valid)
>> + WRITE_ONCE(rq->scx.flags, rq->scx.flags | SCX_RQ_CLK_VALID);
>> +}
>
> Isn't rq->scx.clock used iff VALID is set? If so, why does !VALID read need
> to update rq->scx.clock?
If we drop the previous scx_rq_clock_update(.., false), we can
drop the if condition checking the valid flag.
Regards,
Changwoo Min
Powered by blists - more mailing lists