From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEACC23C512 for ; Sat, 4 Apr 2026 05:36:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775281019; cv=none; b=AI506DNK2MRFMERsir+o+MA2F2S9E8+21OwVzSYrKvfVlR8HdYBGB/QtijkMMXvTzvQ5NRyqSF17Cx0MgRsHGdqaM2eXmaEjUoANCNp2G2qSUzLWuthzThiCXDOZmJTvaB+QSSA7YFerkuqeYeqbWP6zJ0OiApMIykeFc7k5opY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775281019; c=relaxed/simple; bh=b/9eHiGacbALE105KAuHV4Osx9E6Rdf2s9xicbX86OA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=RvEMgHgnLJ7GBEpHm/y37bBpLRK3mYLZqDrl8t4QB6yLPWnjhVsjemqVKyoUbLhSShXUG54Tsu13ChP4OcvrD35Y7uImkr8RBbi/1dH7e1FPsud80m7h6z6WUV4iiNVohYr3NnMxJRDIlGxNx3J6BFF6kwRrf8GKslwdAIFcY0c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jstultz.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=nS9uVECs; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jstultz.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="nS9uVECs" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-35d98c6ab60so3379476a91.1 for ; Fri, 03 Apr 2026 22:36:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775281012; x=1775885812; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=KE6WFf4coARBUHATRGpmX7xHKBPsyY3zBSyjTWWGLwM=; b=nS9uVECsUbJBkhOfDOSeEWpwheC0l0u2FeMK2VEKLIrYIk2MvR6C0C2ZXKxEjsJl7k 3Jnr+kdfCyQzGgFs7WgT1tlxk8xSyeBLAQo5M5Gn+7zyb4NlBMOdbhHPpPFD5b/MIcZf yVjUmbQ04oqZpa7EcAPWT1OxaehDXrTEQs+izswMLWjrFA4I+rFeR3grFRZZYfD9M/r6 19sOkFZgGsRJBzMh+F2A0sJ6bwi/RoQAhMTX6DPz6GKBHb1YrIpRY0C1XwqaH19tApYh f4DX/jS+tdg07ZYSzV0xb1mVUi1xugd4ZzhK4dGxC/c+RR1oOAFzoWR5sCiEG/sIs1VP 5IyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775281012; x=1775885812; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KE6WFf4coARBUHATRGpmX7xHKBPsyY3zBSyjTWWGLwM=; b=B7Q0MAjEfU/oronbKiAgJbXRRQUwJs1XMIsn9/gfs43pMRk/VX8NoRAFJG+Ig81XtW TNiQIpm2Spd9n2psK4okyH7F8u3SX76FMrcIr+1KFS96kdVelXR6M9vAIg1T7PAnLdHL NuqAIjOhP1wcMGyXa0ulIuSArRr19sS3Un+uJp7E8OVkWJig2EeZOrNh0iG6QTaGBeKF SElgOl5Td1L35vSOrnN2G59VxnRZLc9wXACAyTHevovN6X5aS4UXT+QacXMAEOPtryV/ gYMpFFuFrbLKax48WKNHDS8gIEJWrjTFE2gFkC1QCaP3cxLwiyy5J3BHFpws+46Hwp33 vvjQ== X-Gm-Message-State: AOJu0Yyv4ALC5UqvcDHDaNx/eszeUgO0KUnlFe8bkEt4s7x6VrVSPGCU jHV20CPWyKJ9fnfR/qMP4wknzkGS0StKyk2nmMAau1vCh382AM2/DA4KkmD1fw3h8hMyQEo+JRu jwnQVcRCaMKhqMJ+HlCFErfPWCqNqhmq4F01fbId656/BcOHJkQsJnuO8Fim83O/e7kw9+rjJwQ gV4NcmYsGFsUX5N/a7/1rMgGyMb55/Es4VTAlOwoQnwrABwZzm X-Received: from pgib11.prod.google.com ([2002:a63:e70b:0:b0:c6e:4b29:e099]) (user=jstultz job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:4885:b0:39b:e3aa:df2d with SMTP id adf61e73a8af0-39f16ebf8e2mr6063578637.7.1775281011838; Fri, 03 Apr 2026 22:36:51 -0700 (PDT) Date: Sat, 4 Apr 2026 05:36:24 +0000 In-Reply-To: <20260404053632.1729280-1-jstultz@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260404053632.1729280-1-jstultz@google.com> X-Mailer: git-send-email 2.53.0.1213.gd9a14994de-goog Message-ID: <20260404053632.1729280-8-jstultz@google.com> Subject: [PATCH v27 07/10] sched/core: Reset the donor to current task when donor is woken From: John Stultz To: LKML Cc: K Prateek Nayak , John Stultz , Joel Fernandes , Qais Yousef , Ingo Molnar , Peter Zijlstra , 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 Content-Type: text/plain; charset="UTF-8" From: K Prateek Nayak Introduce proxy_reset_donor() to reset the donor to current task when the donor is woken up. This avoids needing to run with rq->idle as the donor when proxy_needs_return() hits the donor which can result in another different set of headaches. Signed-off-by: K Prateek Nayak Signed-off-by: John Stultz --- XXX: Confirm with Juri if there is any side-effect of temporarily doing a set_next_task() on a throttled DL task. Cc: Joel Fernandes Cc: Qais Yousef Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Valentin Schneider Cc: Steven Rostedt Cc: Ben Segall Cc: Zimuzo Ezeozue Cc: Mel Gorman Cc: Will Deacon Cc: Waiman Long Cc: Boqun Feng Cc: "Paul E. McKenney" Cc: Metin Kaya Cc: Xuewen Yan Cc: K Prateek Nayak Cc: Thomas Gleixner Cc: Daniel Lezcano Cc: Suleiman Souhlal Cc: kuyo chang Cc: hupu Cc: kernel-team@android.com --- kernel/sched/core.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 2b5f9f905afe1..a0d55225a62c3 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3660,7 +3660,17 @@ void update_rq_avg_idle(struct rq *rq) } #ifdef CONFIG_SCHED_PROXY_EXEC -static inline struct task_struct *proxy_resched_idle(struct rq *rq); +static void zap_balance_callbacks(struct rq *rq); + +static inline void proxy_reset_donor(struct rq *rq) +{ + WARN_ON_ONCE(rq->donor == rq->curr); + + put_prev_set_next_task(rq, rq->donor, rq->curr); + rq_set_donor(rq, rq->curr); + zap_balance_callbacks(rq); + resched_curr(rq); +} /* * Checks to see if task p has been proxy-migrated to another rq @@ -3685,7 +3695,7 @@ static inline bool proxy_needs_return(struct rq *rq, struct task_struct *p) /* If we're return migrating the rq->donor, switch it out for idle */ if (task_current_donor(rq, p)) - proxy_resched_idle(rq); + proxy_reset_donor(rq); block_task(rq, p, TASK_WAKING); return true; -- 2.53.0.1213.gd9a14994de-goog