public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6] sched_ext: idle: Refresh idle masks during idle-to-idle transitions
Date: Fri, 10 Jan 2025 09:39:09 -1000	[thread overview]
Message-ID: <Z4F3Xcgl9CUhHVyn@slm.duckdns.org> (raw)
In-Reply-To: <20250110084625.562316-1-arighi@nvidia.com>

Hello, Andrea.

On Fri, Jan 10, 2025 at 09:46:25AM +0100, Andrea Righi wrote:
...
> +	if (do_notify) {
> +		if (SCX_HAS_OP(update_idle) && !scx_rq_bypassing(rq))
> +			SCX_CALL_OP(SCX_KF_REST, update_idle, cpu_of(rq), idle);
> +	} else {
> +		bool is_prev_idle;
> +
> +		/* Refresh idle masks during idle-to-idle transitions */

Can you add a bit more explanation on what case this path is handling here
or in the function comment? The function comment explains what it's about
but doesn't quite explain the exact sequence which isn't very intuitive.

> +		rcu_read_lock();
> +		is_prev_idle = is_idle_task(rcu_dereference(rq->curr));
> +		rcu_read_unlock();
> +
> +		if (!is_prev_idle)
>  			return;

This function is always called under the rq lock, right? We can assert that
and skip the rcu dancing.

>  	}
>  
> +	if (!static_branch_likely(&scx_builtin_idle_enabled))
> +		return;

Would structure like the following be better? It makes clear that the last
condition checks are for the builtin idle path.

        if (SCX_HAS_OP(update_idle) && do_notify && !scx_rq_bypassing(rq))
                // call ops.update_idle().

        if (!scx_builtin_idle_enabled || (!do_notify && !is_idle_task(rq->curr)))
                return;

Thanks.

-- 
tejun

  reply	other threads:[~2025-01-10 19:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-10  8:46 [PATCH v6] sched_ext: idle: Refresh idle masks during idle-to-idle transitions Andrea Righi
2025-01-10 19:39 ` Tejun Heo [this message]
2025-01-10 20:19   ` Andrea Righi

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=Z4F3Xcgl9CUhHVyn@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=bsegall@google.com \
    --cc=changwoo@igalia.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=void@manifault.com \
    --cc=vschneid@redhat.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