mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Changwoo Min <changwoo@igalia.com>
To: Andrea Righi <arighi@nvidia.com>
Cc: tj@kernel.org, void@manifault.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: Sun, 22 Dec 2024 13:32:45 +0900	[thread overview]
Message-ID: <da36c0c5-da61-4d27-9bb4-ef9f212102e2@igalia.com> (raw)
In-Reply-To: <Z2Xh3x8CCLPardgm@gpd3>

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

  reply	other threads:[~2024-12-22  4:33 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 [this message]
2024-12-24 21:47   ` Tejun Heo
2024-12-27  0:38     ` Changwoo Min
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=da36c0c5-da61-4d27-9bb4-ef9f212102e2@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=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®