mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH RFC] sched/proxy: Defer donor commit until proxy resolution
@ 2026-07-07 15:46 Xukai Wang
  2026-07-07 15:46 ` [PATCH RFC] sched/proxy: Defer donor commit until after " Xukai Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Xukai Wang @ 2026-07-07 15:46 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
	Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, K Prateek Nayak
  Cc: linux-kernel, Xukai Wang

Hi,

This RFC tries to decouple proxy candidate selection from donor commit in the
scheduler core.

Currently pick_next_task() does not only select a task. It also commits the
selected task into the scheduling class state through put_prev_set_next_task().
With proxy execution enabled, the selected task may be a blocked donor,
and __schedule() then calls find_proxy_task() to resolve the proxy chain and
find the task that should actually run.

If find_proxy_task() returns NULL, __schedule() goes back to pick_again.
However, the picked donor has already been committed into the class current state.
This means the scheduler may first set_next() a blocked donor and then immediately
abandon that choice when proxy resolution fails.

I tested this using a small misc driver which creates controlled contention on a
kernel struct mutex, so that tasks block on the kernel mutex path rather than
only on userspace futexes.

Before this change, one run showed:

total case:
	find_call				75
	find_success				9
	find_idle				23
	find_null				43
null_rate: 57.33%

null case:
	null_chain_changed			0
	null_owner_race				0
	null_deactivate_no_mutex		0
	null_deactivate_no_owner		0
	null_deactivate_owner_not_runnable	21
	null_migrate				22

Most NULL returns came from migration/deactivation paths. In those cases, the
initially picked donor was not the final scheduling decision, but it had already
gone through the class put_prev/set_next transition.

This patch changes the model so that pick_next_task() only returns a candidate.
The actual class commit is moved to __schedule(), after proxy resolution.

After this change, no scheduler WARN_ON_ONCE() was triggered in this test,
including temporary debug checks around rq->dl_server and migration/deactivation
of tasks found while walking the proxy chain.

The main point I would like feedback on is whether this is the right boundary:
pick a proxy candidate first, resolve the proxy chain, then commit the donor
only after the final donor/execution pair is known.

Signed-off-by: Xukai Wang <kingxukai@zohomail.com>
---
Xukai Wang (1):
      sched/proxy: Defer donor commit until after proxy resolution

 kernel/sched/core.c | 70 ++++++++++++++++++++++++++++++-----------------------
 1 file changed, 40 insertions(+), 30 deletions(-)
---
base-commit: 19b7bdc3a1550ab2550427c33395bec7caeaf72d
change-id: 20260707-sched-proxy-4404b6e97ad9

Best regards,
--  
Xukai Wang <kingxukai@zohomail.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-07-13  5:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-07 15:46 [PATCH RFC] sched/proxy: Defer donor commit until proxy resolution Xukai Wang
2026-07-07 15:46 ` [PATCH RFC] sched/proxy: Defer donor commit until after " Xukai Wang
2026-07-10  7:23   ` K Prateek Nayak
2026-07-10 15:00     ` Xukai Wang
2026-07-10 15:14     ` Xukai Wang
2026-07-13  4:22       ` K Prateek Nayak
2026-07-13  5:01         ` Xukai Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome