mirror of https://lore.kernel.org/lkml/
 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>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] sched_ext: Track currently locked rq
Date: Sat, 19 Apr 2025 07:34:16 -1000	[thread overview]
Message-ID: <aAPemAFUsJaF_C2X@slm.duckdns.org> (raw)
In-Reply-To: <20250419123536.154469-2-arighi@nvidia.com>

Hello, Andrea.

On Sat, Apr 19, 2025 at 02:24:30PM +0200, Andrea Righi wrote:
> @@ -149,6 +149,7 @@ struct sched_ext_entity {
>  	s32			selected_cpu;
>  	u32			kf_mask;	/* see scx_kf_mask above */
>  	struct task_struct	*kf_tasks[2];	/* see SCX_CALL_OP_TASK() */
> +	struct rq		*locked_rq;	/* currently locked rq */

Can this be a percpu variable? While rq is locked, current can't switch out
anyway and that way we don't have to increase the size of task. Note that
kf_tasks[] are different in that some ops may, at least theoretically,
sleep.

> +static inline void update_locked_rq(struct rq *rq)
> +{
> +	/*
> +	 * Check whether @rq is actually locked. This can help expose bugs
> +	 * or incorrect assumptions about the context in which a kfunc or
> +	 * callback is executed.
> +	 */
> +	if (rq)
> +		lockdep_assert_rq_held(rq);
> +	current->scx.locked_rq = rq;
> +	barrier();

As these conditions are program-order checks on the local CPU, I don't think
any barrier is necessary.

Thanks.

-- 
tejun

  reply	other threads:[~2025-04-19 17:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-19 12:24 [PATCH 0/2] sched_ext: Introduce rq lock tracking Andrea Righi
2025-04-19 12:24 ` [PATCH 1/2] sched_ext: Track currently locked rq Andrea Righi
2025-04-19 17:34   ` Tejun Heo [this message]
2025-04-19 20:10     ` Andrea Righi
2025-04-19 20:30       ` Andrea Righi
2025-04-19 21:27         ` Andrea Righi
2025-04-20 17:44         ` Tejun Heo
2025-04-20 18:34           ` Andrea Righi
2025-04-19 12:24 ` [PATCH 2/2] sched_ext: Fix missing rq lock in scx_bpf_cpuperf_set() Andrea Righi
2025-04-20 19:30 [PATCH v2 0/2] sched_ext: Introduce rq lock tracking Andrea Righi
2025-04-20 19:30 ` [PATCH 1/2] sched_ext: Track currently locked rq Andrea Righi
2025-04-21 19:03   ` Tejun Heo
2025-04-22  6:27     ` Andrea Righi
2025-04-22  8:26 [PATCH v3 0/2] sched_ext: Introduce rq lock tracking Andrea Righi
2025-04-22  8:26 ` [PATCH 1/2] sched_ext: Track currently locked rq Andrea Righi
2025-07-15  9:13   ` Breno Leitao
2025-07-15 17:20     ` Andrea Righi
2025-07-16 10:47       ` Breno Leitao
2025-07-16 12:40         ` Andrea Righi
2025-07-16 12:43           ` Breno Leitao

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=aAPemAFUsJaF_C2X@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=linux-kernel@vger.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®