[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <da36c0c5-da61-4d27-9bb4-ef9f212102e2@igalia.com>
Date: Sun, 22 Dec 2024 13:32:45 +0900
From: Changwoo Min <changwoo@...lia.com>
To: Andrea Righi <arighi@...dia.com>
Cc: tj@...nel.org, void@...ifault.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()
Hi Andrea,
On 24. 12. 21. 06:30, Andrea Righi wrote:
> Hi Changwoo,
>
> On Fri, Dec 20, 2024 at 03:20:21PM +0900, Changwoo Min wrote:
> ...
>> + /*
>> + * If the rq clock is valid, use the cached rq clock.
>> + * Otherwise, return a fresh rq glock.
>
> s/glock/clock/
Opps. My bad.
>> + 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);
>> + }
>
> I was wondering if we could use a special value for clock (like ~0ULL or
> similar) to mark the clock as invalid.
>
> This way, we could get rid of the extra READ_ONCE(rq->scx.flags) logic for
> checking the clock validity. And if the actual clock happens to match the
> special value, we'd simply re-read the TSC, which shouldn't be a big issue
> in theory.
Thank you for the suggestion. In theory, the clock can overflow,
so it would be hard to reserve a specific value. I think it would
be better to keep the code as it is.
Regards,
Changwoo Min
Powered by blists - more mailing lists