From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 2544B3E44E0 for ; Fri, 26 Jun 2026 07:46:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782459982; cv=none; b=qwPiic6w8l+eQD76EF7Ho9IgudI0mVYE/m2E3k9MRZ0F2ZWlwb0+DZI0P6DTHLCs00OU9jVXLFMPBnAUAR4DX727mjGgprwJRRQ39tbGOVP4mbQIKT06ZiQ6LGQ1Sq+wehuqQmAH/lnwCOjBN4bQ9hMvsUprLyIsmjaWEFao40c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782459982; c=relaxed/simple; bh=a3IP3Ni0gtRkQO21JZkKfSZkXVJ3N5AwsFQd0q/PTas=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HGy5PzUegXZEsTftJ/Uz/xycxPTdinrUfrYWz/zHcCc5mQgB4NyCJM/oqUcMHf6SfBMk9D5BJvCfNmNbU/0PN7ahoMGR4dxBMtj8cMFiPsq2O7SmcVt0g8YaiT8UoCqpA6KZ1k2VqExnR2TJDDAe8jrv3pZNxxpXUSYeOIV6kQE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=eHT2uaFv; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass 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="eHT2uaFv" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=WFEqG/qL8djVrvB948TxDqvoC29O6e0eg6yI239thsA=; b=eHT2uaFvfOlfUnwbcpompJ9DpC eeIFQeb1V9qynlv2G6JMK2LgKo3CLTaUtV4OKvR95efSn6mxIhzkcD6i/xXpD/0MpyXcrWk4jb8Qo UbAdNMtLSxIH+k3rxn0z5ZhakQSb0cb92xyx3eWClbxXAEFSWJ9B2uDzXqbZfP6MRO74cWYP7pjNF roxwWB7C9bAH0vsF1X/11ikPn0WkC0fKAsmNImeA/4AJ4SHno05AUtLBigwFdbjVlBoOhgSDkdEGD jKLI6LYvJ/CVZKd9Tu3vlz6RXTtMg4Gnq2Jq+VFj7G0en7exVa8MY1tlcDQMZDkMbtFVRkiMmK4fi AJCz9TXA==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.99.1 #2 (Red Hat Linux)) id 1wd1GH-0000000BRWy-2F5Y; Fri, 26 Jun 2026 07:46:06 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 5979A300BDE; Fri, 26 Jun 2026 09:46:05 +0200 (CEST) Date: Fri, 26 Jun 2026 09:46:05 +0200 From: Peter Zijlstra To: Vincent Guittot Cc: mingo@redhat.com, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, kprateek.nayak@amd.com, linux-kernel@vger.kernel.org, qyousef@layalina.io Subject: Re: [PATCH 3/6 v3] sched/eevdf: Update slice protection even when resched is already set Message-ID: <20260626074605.GB2568396@noisy.programming.kicks-ass.net> References: <20260624151229.1710703-1-vincent.guittot@linaro.org> <20260624151229.1710703-4-vincent.guittot@linaro.org> <20260626072128.GI1181229@noisy.programming.kicks-ass.net> 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: <20260626072128.GI1181229@noisy.programming.kicks-ass.net> On Fri, Jun 26, 2026 at 09:21:28AM +0200, Peter Zijlstra wrote: > On Wed, Jun 24, 2026 at 05:12:26PM +0200, Vincent Guittot wrote: > > Even if resched is already set, we might want to update or even cancel > > the slice protection and ensure that the newly waking task will be the > > next one to run. > > > > Signed-off-by: Vincent Guittot > > Tested-by: K Prateek Nayak > > --- > > kernel/sched/fair.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > > index 8639086e5d9e..854f3a9f1d80 100644 > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -9804,7 +9804,7 @@ static void wakeup_preempt_fair(struct rq *rq, struct task_struct *p, int wake_f > > * prevents us from potentially nominating it as a false LAST_BUDDY > > * below. > > */ > > - if (test_tsk_need_resched(rq->curr)) > > + if (!sched_feat(PREEMPT_SHORT) && test_tsk_need_resched(rq->curr)) > > return; > > > > if (!sched_feat(WAKEUP_PREEMPTION)) > > This one is leading to boot splats for me -- let me try and figure out > why. Bah! Subject: sched/core: Fix inter-class wakeup_preempt() From: Peter Zijlstra Date: Fri Jun 26 09:36:52 CEST 2026 The way wakeup_preempt() works since commit 704069649b5b ("sched/core: Rework sched_class::wakeup_preempt() and rq_modified_*()") is that it will call rq->next_class->wakeup_preempt(rq, p) when p is of an equal or higher class, and raise ->next_class when higher. This means that: running idle task wakeup fair-A (next_class == idle) if (sched_class_above(fair, idle)) { wakeup_preempt_idle(fair-A); resched_curr(rq); next_class = fair; } wakeup fair-B (next_class == fair) if (fair == fair) wakeup_preempt_fair(fair-B); (but current is idle) All wakeup_preempt_$class() methods, except for wakeup_preempt_scx() (for whoem this was build) ignore cross-class wakeups by testing if @p is of the right class, but per the above case, it also should check current. This is mostly harmless in the current form, but will lead to trouble with later patches. Fixes: 704069649b5b ("sched/core: Rework sched_class::wakeup_preempt() and rq_modified_*()") Signed-off-by: Peter Zijlstra (Intel) --- kernel/sched/deadline.c | 6 ++++-- kernel/sched/fair.c | 3 ++- kernel/sched/rt.c | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -2733,15 +2733,17 @@ static int balance_dl(struct rq *rq, str */ static void wakeup_preempt_dl(struct rq *rq, struct task_struct *p, int flags) { + struct task_struct *donor = rq->donor; /* * Can only get preempted by stop-class, and those should be * few and short lived, doesn't really make sense to push * anything away for that. */ - if (p->sched_class != &dl_sched_class) + if (p->sched_class != &dl_sched_class || + donor->sched_class != &dl_sched_class) return; - if (dl_entity_preempt(&p->dl, &rq->donor->dl)) { + if (dl_entity_preempt(&p->dl, &donor->dl)) { resched_curr(rq); return; } --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9778,7 +9778,8 @@ static void wakeup_preempt_fair(struct r /* * XXX Getting preempted by higher class, try and find idle CPU? */ - if (p->sched_class != &fair_sched_class) + if (p->sched_class != &fair_sched_class || + donor->sched_class != &fair_sched_class) return; if (unlikely(se == pse)) --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1629,7 +1629,8 @@ static void wakeup_preempt_rt(struct rq /* * XXX If we're preempted by DL, queue a push? */ - if (p->sched_class != &rt_sched_class) + if (p->sched_class != &rt_sched_class || + donor->sched_class != &rt_sched_class) return; if (p->prio < donor->prio) {