From: Changwoo Min <changwoo@igalia.com>
To: Tejun Heo <tj@kernel.org>, Changwoo Min <multics69@gmail.com>
Cc: void@manifault.com, arighi@nvidia.com, mingo@redhat.com,
peterz@infradead.org, kernel-dev@igalia.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/6] sched_ext: Implement scx_bpf_now_ns()
Date: Fri, 27 Dec 2024 09:38:37 +0900 [thread overview]
Message-ID: <5eeef2e1-7dc4-4aa8-8be4-c6e0fc2b5267@igalia.com> (raw)
In-Reply-To: <Z2ssCtnEciplLogy@slm.duckdns.org>
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
next prev parent reply other threads:[~2024-12-27 0:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-20 6:20 [PATCH v6 0/6] sched_ext: Support high-performance monotonically non-decreasing clock Changwoo Min
2024-12-20 6:20 ` [PATCH v6 1/6] sched_ext: Relocate scx_enabled() related code Changwoo Min
2024-12-20 6:20 ` [PATCH v6 2/6] sched_ext: Implement scx_bpf_now_ns() Changwoo Min
2024-12-20 21:30 ` Andrea Righi
2024-12-22 4:32 ` Changwoo Min
2024-12-24 21:47 ` Tejun Heo
2024-12-27 0:38 ` Changwoo Min [this message]
2024-12-20 6:20 ` [PATCH v6 3/6] sched_ext: Add scx_bpf_now_ns() for BPF scheduler Changwoo Min
2024-12-20 6:20 ` [PATCH v6 4/6] sched_ext: Add time helpers for BPF schedulers Changwoo Min
2024-12-24 21:49 ` Tejun Heo
2024-12-27 0:32 ` Changwoo Min
2024-12-20 6:20 ` [PATCH v6 5/6] sched_ext: Replace bpf_ktime_get_ns() to scx_bpf_now_ns() Changwoo Min
2024-12-20 6:20 ` [PATCH v6 6/6] sched_ext: Use time helpers in BPF schedulers Changwoo Min
2024-12-20 22:29 ` [PATCH v6 0/6] sched_ext: Support high-performance monotonically non-decreasing clock Andrea Righi
2024-12-22 6:37 ` Changwoo Min
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5eeef2e1-7dc4-4aa8-8be4-c6e0fc2b5267@igalia.com \
--to=changwoo@igalia.com \
--cc=arighi@nvidia.com \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=multics69@gmail.com \
--cc=peterz@infradead.org \
--cc=tj@kernel.org \
--cc=void@manifault.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®