From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sender4-pp-o94.zoho.com (sender4-pp-o94.zoho.com [136.143.188.94]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E90C82F8E9E for ; Tue, 7 Jul 2026 15:47:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.94 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783439250; cv=pass; b=PbjH7iM1ZKrrQK2HkcOZDIMkYD4Sr3LkGySIDEb/5N7foRRhPAUYuyeE6Kz8Dhf1MSNc0gci4Ax0l6cKeoc2qEs9u8974Ni4BwLiq+OtiX3LW4NG/SooDYkr7I1Lniw/ka8+23lhTkszCZ28UqKkeADJJkvt2DhbAh17VCe3JHI= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783439250; c=relaxed/simple; bh=kh39jDn4QDxvsX5wdq/oLy8agBjLUK0wb7Keua51kL0=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=fTWOxo4g7d6lu4MBTu4/0yptV0rL6JvCYAg9INVeTfxALaBcKLG7uL015oKgDdDXy45GYAZy0e2LgSM9bjtYTZAi/2OaIunDCs6eRigRgPvY+tCd2XpJwXCgIzFrEEwQvstkP7ithTEq37JVKxgRwEtKKUM/w76HSVjmZzdznG4= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=zohomail.com; spf=pass smtp.mailfrom=zohomail.com; dkim=pass (1024-bit key) header.d=zohomail.com header.i=kingxukai@zohomail.com header.b=VXUTxx/u; arc=pass smtp.client-ip=136.143.188.94 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=zohomail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zohomail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zohomail.com header.i=kingxukai@zohomail.com header.b="VXUTxx/u" ARC-Seal: i=1; a=rsa-sha256; t=1783439221; cv=none; d=zohomail.com; s=zohoarc; b=SU9IqqWNMIHZRtpx4iUg4Se1o0Ta3i/PP27NVVs1Oc9f8fCC5S9hmGAVEZ5VKMc0tbhba+ikcg41XalhvOtMvyK8TdvISB+TN39ESsXASrXklxD1WidpMk4cNPcB0TCOUzjvcI32SDb7G6yLF+hZtfUX4bpeSNIItBjR19EKQT8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1783439221; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=mXH5fxnChdH2UFhC0pNG71e7h3G/saXMv2CgechIAuk=; b=KWL+CvFA9ODcrGNEyYCn7/4stdszxo8E4khlkCl3+epxVSw5K4T4UmG5eQOLF7QckOnmVuSCLr4TkOvoM2gYsuO0WUgEBwHZqumUGLiwPhN6hP1WWv9RrGEdoCnOuy+8ADicplnz/tMgSVvtJR9jevd+zUXBV1sPmezvmyQ6it8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zohomail.com; spf=pass smtp.mailfrom=kingxukai@zohomail.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1783439221; s=zm2022; d=zohomail.com; i=kingxukai@zohomail.com; h=From:From:Subject:Subject:Date:Date:Message-Id:Message-Id:MIME-Version:Content-Type:Content-Transfer-Encoding:To:To:Cc:Cc:Feedback-ID:Reply-To; bh=mXH5fxnChdH2UFhC0pNG71e7h3G/saXMv2CgechIAuk=; b=VXUTxx/u+FN/n1CzlkffMCZydzTHdDdMC0962jswa8/jZ6pWlpbza3/5XKHt0iSf ENXK8RHDIQAVUQwyFI9HFemLIE2oqST4PbqZv5YffrUDt7vFfcunpFEzzIQn2shcZ+j 70TK6KfcgzNbt+gtiysoFsPBlJjEC1fciUlKvCTA= Received: by mx.zohomail.com with SMTPS id 178343921626925.494066537979165; Tue, 7 Jul 2026 08:46:56 -0700 (PDT) From: Xukai Wang Subject: [PATCH RFC] sched/proxy: Defer donor commit until proxy resolution Date: Tue, 07 Jul 2026 23:46:37 +0800 Message-Id: <20260707-sched-proxy-v1-0-5928bf6dedf0@zohomail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAF0fTWoC/y2NQQ6CMBREr0L+2ialLTR1a+IB3BoW7e9HaoJgC wZDuLtV2UwykzczKySKgRIcixUivUIKwyOb8lAAdvZxIxZ89iC4qLnmmiXsyLMxDsubKcWVq8l o6w3kxhipDctv7QqX8wmaf5hmdyecvjs7Fuk5569pZ51NxHDo+zDlb+O08yhtWVXcOpFVCY1SS lM5Qo2WbKuFh2bbPiuS2Y3AAAAA X-Change-ID: 20260707-sched-proxy-4404b6e97ad9 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@vger.kernel.org, Xukai Wang X-Mailer: b4 0.15.2 Feedback-ID: zu080112276c96da1bce2a0f4f5bbee53d0000b5fb40d19c53885dd73e188cc8d2bca591162a1a259053ddf4:ZohoMail X-Zoho-CM-AccountID: 2ee5dd3c83366259b2ba1e9826250ffebed1ef2dd213857d649ad25aba73b429 X-ZohoMailClient: External 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 --- 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