mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: John Stultz <jstultz@google.com>, Hui Su <sh_def@163.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Zhidao Su <soolaugust@gmail.com>,
	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: [RFC PATCH 1/1] sched/proxy_exec: detect cycles in proxy walks
Date: Tue, 22 Sep 2026 11:18:02 +0530	[thread overview]
Message-ID: <8669890e-c8a5-448e-b059-d959e3a1d73c@amd.com> (raw)
In-Reply-To: <CANDhNCqZwGk+wqhB4N8Emq0rPmzsrVWzHmayiSj9ptg-vLzo3Q@mail.gmail.com>

On 9/22/2026 10:56 AM, John Stultz wrote:
> On Mon, Sep 14, 2026 at 9:55 AM Hui Su <sh_def@163.com> wrote:
>>
>> Proxy execution follows blocked_on relationships to find a runnable lock
>> owner. A cycle in that chain can make find_proxy_task() loop indefinitely
>> while holding rq->lock.
>>
>> Use Brent checkpoint state directly in the real owner walk. Cycle detection
>> reuses the owner resolution already performed by that walk and requires no
>> separate preflight traversal. The checkpoint, power, and span state are all
>> invocation-local.
>>
>> Keep the existing owner == p wakeup-race handling ahead of cycle detection.
>> Unlike a sequence-marker approach, this adds no task_struct or runqueue
>> state and requires no activation-time reset.
>>
>> The online walk can temporarily install a blocked_donor cycle before the
>> delayed Brent detection point. In the tested recovery path, the selected
>> task's blocked_donor was cleared before it resumed. A forced-stale control
>> also confirmed that mutex handoff revalidates the donor's blocked_on
>> relationship before consuming a backlink. Validation of this trade-off and
>> comparative measurements against the sequence-marker approach are included
>> in the cover letter.
>>
>> Signed-off-by: Hui Su <sh_def@163.com>
> 
> Hey! Thanks for sending this out and apologies for my slow response to
> your patches.
> 
> This looks interesting, and with Suleiman's futex work, it becomes
> more critical to include.
> 
> I think similar to what Peter already mentioned, having a max depth
> counter is probably still a good idea, but it does seem like this
> would catch smaller cycles earlier without much overhead.
> 
> I've included an simplified version of Zhidao Su's earlier work (using
> a fixed MAX_PROXY_CHAIN_DEPTH) in my tree, but will include this as
> well as an potential optimization.

So if we are eventually planning on returning -EDEADLK to userspace
(context: https://lore.kernel.org/lkml/20260917153649.GK4121339@noisy.programming.kicks-ass.net/)
do we care where the chain starts or can we return -EDEADLK anywhere
in the chain?

I think Brent checkpoint first converges to some point in the chain
and then requires additional traversal to find the beginning of the
chain. Is that fine?

-- 
Thanks and Regards,
Prateek


  reply	other threads:[~2026-09-22  5:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 16:54 [RFC PATCH 0/1] sched/proxy_exec: detect cycles without persistent walk state Hui Su
2026-09-14 16:54 ` [RFC PATCH 1/1] sched/proxy_exec: detect cycles in proxy walks Hui Su
2026-09-22  5:26   ` John Stultz
2026-09-22  5:48     ` K Prateek Nayak [this message]
2026-09-22  6:06       ` John Stultz
2026-09-22  7:18         ` Peter Zijlstra
2026-09-19 15:51 ` [RFC PATCH 0/1] sched/proxy_exec: detect cycles without persistent walk state Hui Su

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=8669890e-c8a5-448e-b059-d959e3a1d73c@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=jstultz@google.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=sh_def@163.com \
    --cc=soolaugust@gmail.com \
    --cc=vincent.guittot@linaro.org \
    --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

all inboxes | Powered by JetHome®