mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Kuba Piecuch <jpiecuch@google.com>
Cc: David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	Changwoo Min <changwoo@igalia.com>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH sched_ext/for-7.4-fixes] sched_ext: Clarify ops.sub_caps_updated() context and intended use
Date: Mon, 30 Nov 2026 05:26:37 -1000	[thread overview]
Message-ID: <3ff50fc71138b619629bf83af9618cbe@kernel.org> (raw)
In-Reply-To: <20261130125422.3895514-1-jpiecuch@google.com>

Hello, Kuba.

On Mon, Nov 30, 2026 at 12:55:09PM +0000, Kuba Piecuch wrote:
> +	 * Delivered synchronously from the parent's scx_bpf_sub_grant() /
> +	 * scx_bpf_sub_revoke() after the shard lock is released, or unlocked
> +	 * from scx_sub_seed_caps() when seeding caps granted during
> +	 * ops.sub_attach(). It therefore inherits whatever locking context
> +	 * the parent holds (e.g. an rq lock, or unlocked from an unlocked
> +	 * caller) and may run before the change takes effect on any given cpu.

AFAICS, this doesn't hold when a delivery for the shard is already in
flight. caps_updated_record() then only folds the change into the buffer
and the kfunc returns without delivering it. The caller which is already
delivering reports the change from its own context, possibly after the
kfunc that made the change has returned. This can only happen when updates
to the same shard race each other. Maybe we can figure out something
better in the future but, for now, can you document the condition? The
same goes for the struct scx_caps_updated comment and the two kfunc
comments.

Also, scx_bpf_sub_revoke() walks the whole subtree, so the caller can be
any ancestor, not only the parent.

> + * Any resulting ops.sub_caps_updated() callbacks are delivered synchronously
> + * after the shard locks are released (inheriting the caller's locking context),
> + * except when called from ops.sub_attach(), where scx_sub_seed_caps() delivers
> + * them unlocked once the child's ops are ready.

Leaving the delivery to scx_sub_seed_caps() isn't specific to
ops.sub_attach(). It happens for any grant or revoke made before the
child's ops are ready.

Thanks.

--
tejun

  reply	other threads:[~2026-11-30 15:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 12:55 Kuba Piecuch
2026-11-30 15:26 ` Tejun Heo [this message]
2026-11-30 17:21   ` Kuba Piecuch

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=3ff50fc71138b619629bf83af9618cbe@kernel.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=jpiecuch@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --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®