From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 010973914EB for ; Fri, 27 Mar 2026 11:49:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774612146; cv=none; b=k9JMAq+Tv10IlDFomRyYSSUXLAJeg+XEP5oMiHSPsRUKyzxvxqLg9Af81YZ3e7Ymgbac1hTw/9wUxHdYJkpdkwRdmIFbowOIVEW1Mpm1etJLnPwfBL73btnmv+bBG479Fm0UZyIZAbb9FHUJf4yJQTe7GK+0r0xgb5V1FlWvoGE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774612146; c=relaxed/simple; bh=Z4//RVdLtn5E0WHHbQIv7pTv1CvcmN/mhmD8QyW5L6s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VKHclKfEZh2Pqt/4pr2w4Ymtj/E/GHrk+EhX4ny0j+EsOK38nj3KbooOkNdpG5JN89E7CAvxGaEpn4a2VPLE8l2pKozyqb4qgXQeCQAlACQizsK5jC3cxNToTpZ5Bk8TL9sjtgFkmQ3T5BlabwUw2T2Nj7KMN4JAUp8+NRdEcL4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=EYvBDqyS; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="EYvBDqyS" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=xXO82ToIu0vB2uoz3jzQwplf0tGj14Ffy7P6vbCtajc=; b=EYvBDqyS2yxvc/FiXAIQNR0OGj Ikhi6TDfNmSZm8QRlromlzoYc1NUobEXihcNuj75f4Cq+6sx92K2mw7YaGu5Ts5F+lnXHflXTEfUe LvLqoVu9fUZxOP4PRk9Wh7LQuPfAPqNtC76EkpX5c8Hz50YLuguJFsnCPfAjaYK/tuk5upo7fLBXb 3aZ+EbO5ffsaf9Dkr05p6i546PK/uIzf5NdxEpadCmu7kZ/XPiVM/RzOf7FlthObb8iKlC2le0zx4 LVFpG2sYcJnVyMcFWZbCXQjszqvUbyDTmn/E7VbSfau+AECjRRp0Ht5470Jv+FjvoLfo3miEPayRg Gi9/adHg==; Received: from 2001-1c00-8d85-4b00-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:4b00:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1w65gF-0000000AKkx-0L9Y; Fri, 27 Mar 2026 11:48:47 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 8DA0F300E56; Fri, 27 Mar 2026 12:48:44 +0100 (CET) Date: Fri, 27 Mar 2026 12:48:44 +0100 From: Peter Zijlstra To: K Prateek Nayak Cc: John Stultz , LKML , Joel Fernandes , Qais Yousef , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Valentin Schneider , Steven Rostedt , Ben Segall , Zimuzo Ezeozue , Mel Gorman , Will Deacon , Waiman Long , Boqun Feng , "Paul E. McKenney" , Metin Kaya , Xuewen Yan , Thomas Gleixner , Daniel Lezcano , Suleiman Souhlal , kuyo chang , hupu , kernel-team@android.com Subject: Re: [PATCH v26 00/10] Simple Donor Migration for Proxy Execution Message-ID: <20260327114844.GQ2872@noisy.programming.kicks-ass.net> References: <20260324191337.1841376-1-jstultz@google.com> <36e96f87-a682-436e-aefc-13e2e5810019@amd.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=us-ascii Content-Disposition: inline In-Reply-To: <36e96f87-a682-436e-aefc-13e2e5810019@amd.com> On Wed, Mar 25, 2026 at 04:22:14PM +0530, K Prateek Nayak wrote: I tried to have a quick look, but I find it *very* hard to make sense of the differences. (could be I just don't know how to operate github -- that seems a recurrent theme) Anyway, this: > fd60c48f7b71 sched: Avoid donor->sched_class->yield_task() null traversal That seems *very* dodgy indeed. Exposing idle as the donor seems ... wrong? Anyway, you seem to want to drive the return migration from the regular wakeup path and I don't mind doing that, provided it isn't horrible. But we can do this on top of these patches, right? That is, I'm thinking of taking these patches, they're in reasonable shape, and John deserves a little progress :-) I did find myself liking the below a little better, but I'll just sneak that in. --- --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6822,7 +6822,6 @@ static struct task_struct * find_proxy_task(struct rq *rq, struct task_struct *donor, struct rq_flags *rf) __must_hold(__rq_lockp(rq)) { - enum { FOUND, DEACTIVATE_DONOR, MIGRATE, NEEDS_RETURN } action = FOUND; struct task_struct *owner = NULL; bool curr_in_chain = false; int this_cpu = cpu_of(rq); @@ -6838,8 +6837,7 @@ find_proxy_task(struct rq *rq, struct ta clear_task_blocked_on(p, PROXY_WAKING); return p; } - action = NEEDS_RETURN; - break; + goto force_return; } /* @@ -6874,16 +6872,14 @@ find_proxy_task(struct rq *rq, struct ta __clear_task_blocked_on(p, NULL); return p; } - action = NEEDS_RETURN; - break; + goto force_return; } if (!READ_ONCE(owner->on_rq) || owner->se.sched_delayed) { /* XXX Don't handle blocked owners/delayed dequeue yet */ if (curr_in_chain) return proxy_resched_idle(rq); - action = DEACTIVATE_DONOR; - break; + goto deactivate; } owner_cpu = task_cpu(owner); @@ -6894,8 +6890,7 @@ find_proxy_task(struct rq *rq, struct ta */ if (curr_in_chain) return proxy_resched_idle(rq); - action = MIGRATE; - break; + goto migrate_task; } if (task_on_rq_migrating(owner)) { @@ -6952,26 +6947,20 @@ find_proxy_task(struct rq *rq, struct ta * guarantee its existence, as per ttwu_remote(). */ } - - /* Handle actions we need to do outside of the guard() scope */ - switch (action) { - case DEACTIVATE_DONOR: - if (proxy_deactivate(rq, donor)) - return NULL; - /* If deactivate fails, force return */ - p = donor; - fallthrough; - case NEEDS_RETURN: - proxy_force_return(rq, rf, p); - return NULL; - case MIGRATE: - proxy_migrate_task(rq, rf, p, owner_cpu); - return NULL; - case FOUND: - /* fallthrough */; - } WARN_ON_ONCE(owner && !owner->on_rq); return owner; + +deactivate: + if (proxy_deactivate(rq, donor)) + return NULL; + /* If deactivate fails, force return */ + p = donor; +force_return: + proxy_force_return(rq, rf, p); + return NULL; +migrate_task: + proxy_migrate_task(rq, rf, p, owner_cpu); + return NULL; } #else /* SCHED_PROXY_EXEC */ static struct task_struct *