mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hui Su <sh_def@163.com>
To: "zhidao su (Xiaomi)" <soolaugust@gmail.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	John Stultz <jstultz@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	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 v5] sched/proxy_exec: Detect cycles in proxy walks
Date: Tue, 15 Sep 2026 02:10:00 +0900	[thread overview]
Message-ID: <f2f8ba0f978a894a949bf7b993594d4e.sh_def@163.com> (raw)
In-Reply-To: <20260722120346.93000-1-soolaugust@gmail.com>

> Use the rq pick sequence as a per-walk marker. Mark each task visited by
> the current walk. If the walk sees the same marker again, break the cycle
> by clearing blocked_on at the detection point and deactivating that task.
>
> The marker is only consumed while holding rq->lock. Clear it when a task is
> activated, so stale state from an earlier pick or another rq is not carried
> into the next queued lifetime.

I have been experimenting with a different trade-off for the same cycle
detection problem. I sent it as a separate RFC so it can be reviewed
independently from the sequence-marker approach:

https://lore.kernel.org/lkml/20260914165455.2126134-1-sh_def@163.com/

The Online Brent version keeps the cycle-detection state local to the real
owner walk. It does not add state to task_struct or struct rq, and it does
not require activation-time marker reset. The cycle detector reuses the
owner resolution performed by the real walk instead of adding a separate
preflight traversal.

The trade-off is that Brent may detect a cycle only after the walk has
temporarily closed the blocked_donor cycle. In the tested natural recovery
path, the selected cycle member reached mutex_unlock() with blocked_donor
already cleared. A validation-only forced-stale test also confirmed that
the existing blocked_on revalidation rejects a stale handoff. I do not
claim that these tests cover every possible scheduling interleaving.

The RFC includes a comparison against this v5 implementation on the same
base, configuration, KVM setup, and staged testcase. The normal acyclic
find_proxy_task() timings were comparable in the tested depths; the main
design question is whether avoiding persistent task/rq visitation state and
its activation lifecycle is worth accepting the transient backlink window.

Thanks for the v5 implementation and the detailed discussion.


      parent reply	other threads:[~2026-09-14 17:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14  5:36 [PATCH] sched/proxy_exec: Limit find_proxy_task() chain depth to prevent CPU hang soolaugust
2026-04-21  2:27 ` John Stultz
2026-04-21  3:13   ` K Prateek Nayak
2026-04-21 12:02     ` zhidao su
2026-04-21 12:08     ` zhidao su
2026-07-14 15:21     ` [PATCH v2] sched/proxy_exec: Break cyclic proxy chains by deactivating blocked tasks soolaugust
2026-07-14 20:46       ` K Prateek Nayak
2026-07-15  2:37       ` soolaugust
2026-07-15  3:01         ` K Prateek Nayak
2026-07-15  8:50           ` zhidao su
2026-07-17 10:52       ` [PATCH v3] sched/proxy_exec: Detect cycles in proxy walks zhidao su (Xiaomi)
2026-07-17 11:50         ` K Prateek Nayak
2026-07-17 12:55           ` [PATCH v4] " zhidao su (Xiaomi)
2026-07-21  3:41             ` K Prateek Nayak
2026-07-22 12:03               ` [PATCH v5] " zhidao su (Xiaomi)
2026-08-12 21:29                 ` John Stultz
2026-08-13  4:09                   ` zhidao su
2026-09-14 17:10                 ` Hui Su [this message]

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=f2f8ba0f978a894a949bf7b993594d4e.sh_def@163.com \
    --to=sh_def@163.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=jstultz@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --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®