From nobody Sat Jun 13 23:11:23 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 3B994421EF1; Tue, 5 May 2026 10:50:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978214; cv=none; b=P5fwj6jipSVYKmcHBU8qk1SS5nb6dOHKcnGB0IP77uOb78cZk7t91o/p/WF6VxGo4kYhU6V4F38nEQ2z0YJV5qcy9NnVfoZjmp6+i1q9EPKtLlW8rdajlLthRYt8pztiW5vbn88cqb+a2WENubYoJaiaDqw6lXmClqg5Kwiv8m0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777978214; c=relaxed/simple; bh=tJX3Z6kAXTLvDLq8eQWAc9MUfbzdveoR12GqLr2AbKQ=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=iDeQ0+QTZO0l9H3YLBL14ebVEuI7qYS5Hw10pSa83br7CKzghuT5BuYYr6rnvt2UCY0YLEU1hcEZgOSj7SOMLCQkKktztjQxlYfoh+zbM31lIsjWw+ABhgiY9PytYPLVksQ9xJhtmClx4vLVMwvrzlTGNabWC8swusOoFx5ool0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=WaTwVykK; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=uvyw8jyg; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="WaTwVykK"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="uvyw8jyg" Date: Tue, 05 May 2026 10:50:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777978209; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4ZJzkluTBz0iaSz1S8qn6la0YTyrswxbn/ABEZ+oHFI=; b=WaTwVykKoE1SbfDTuqZUkpDe4iuqalbxdGQH1Yc6Hi1rRsXThUqbJyDKJgUy7t1s4yIQjK mROIjSft220R/XCJU+V2C1a/QOld0JnjxV16hr5QJb5A0mVhtKUZjB5shyuS2CGpQuCrk1 G/W1AI75mez3hDUAfaPC2YW5b+uZ+1RNETmtSmm6fx794iurvsPmEMZ22e4NMDhZC6rPBV zifNaFvJol6RbFo1wAejVKX9XRKiREI1lo4knX9NaPm2qQnNQC1PKKWtKehXIIkqoC5x6v BkQbJyW/4u7t7cXB17TzxSexILjV99wqRG7UH339+TeBA9k54aYxMbFBJXnSjA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777978209; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4ZJzkluTBz0iaSz1S8qn6la0YTyrswxbn/ABEZ+oHFI=; b=uvyw8jygP6B+QDZLmL1L1tKCSwZSG1ZpJg0dxlrwhwZDZCVbH1In75iLaS3vmpDCR0ag8K O02oGrvh+2wBIrBw== From: "tip-bot2 for Vincent Guittot" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/urgent] sched/fair: Fix wakeup_preempt_fair() for not waking up task Cc: Vincent Guittot , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260503104503.1732682-1-vincent.guittot@linaro.org> References: <20260503104503.1732682-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177797820771.424702.10005507936696822305.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the sched/urgent branch of tip: Commit-ID: 3ed412adc88d914acf45c5a304366be0b30cfd0a Gitweb: https://git.kernel.org/tip/3ed412adc88d914acf45c5a304366be0b= 30cfd0a Author: Vincent Guittot AuthorDate: Sun, 03 May 2026 12:45:03 +02:00 Committer: Peter Zijlstra CommitterDate: Tue, 05 May 2026 12:44:24 +02:00 sched/fair: Fix wakeup_preempt_fair() for not waking up task Make sure to only call pick_next_entity() on an non-empty cfs_rq. The assumption that p is always enqueued and not delayed, is only true for wakeup. If p was moved while delayed, pick_next_entity() will dequeue it and the cfs might become empty. Test if there are still queued tasks before try= ing again to determine if p could be the next one to be picked. There are at least 2 cases: When cfs becomes idle, it tries to pull tasks but if those pulled tasks are delayed, they will be dequeued when attached to cfs. attach_tasks() -> attach_task() -> wakeup_preempt(rq, p, 0); A misfit task running on cfs A triggers a load balance to be pulled on a be= tter cpu, the load balance on cfs B starts an active load balance to pulled the running misfit task. If there is a delayed dequeue task on cfs A, it can be pulled instead of the previously running misfit task. attach_one_task() -> attach_task() -> wakeup_preempt(rq, p, 0); Fixes: ac8e69e69363 ("sched/fair: Fix wakeup_preempt_fair() vs delayed dequ= eue") Signed-off-by: Vincent Guittot Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260503104503.1732682-1-vincent.guittot@lin= aro.org --- kernel/sched/fair.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b91c8b2..3ebec18 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9174,9 +9174,10 @@ pick: =20 /* * Because p is enqueued, nse being null can only mean that we - * dequeued a delayed task. + * dequeued a delayed task. If there are still entities queued in + * cfs, check if the next one will be p. */ - if (!nse) + if (!nse && cfs_rq->nr_queued) goto pick; =20 if (sched_feat(RUN_TO_PARITY))