From nobody Sat Jun 13 14:52:57 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 3724647CC94; Wed, 6 May 2026 15:51:57 +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=1778082721; cv=none; b=lxasQrrP9qw1XN5BTonIBPcOHVBqfUhM5wsFsIsmjAwe0U0SopGRG/IRXV4JkJ0Qm+oPfNpNldNUjgXEGNlv4ojzvy3NFTDoYar6kQLuweoN9uo/aj6r67oMfWzLWK7P24XOKQd1ovPYzxUtiTtdfqSp6nLXHdY79kqzZtjO9N4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778082721; c=relaxed/simple; bh=5+dGa2b5nX1O4OQOgqpfTWvzlcYG9/m8Asx/JqVQbjE=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=YKKGQGxG/BFxruCsQHiPl5j1TkkXnK5ir+4zW4na9CD4uZXtqL9SEJS2c8LtNHZrNcaHRYH3fCvwMJbYDMrNPxiNooAPR6m2YO1bKfQZWVQ/t8hip4YXXy6YiPc/nOCs3LcMj5YEfTOjVFYDSvp9EgG80mswJtvTYy/GLjB0byY= 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=VfBz7lGs; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Ww2oSeXB; 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="VfBz7lGs"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Ww2oSeXB" Date: Wed, 06 May 2026 15:51:49 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1778082711; 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=MCJ8dPcl9O8F1U9fi9QjxgE3L9J53Y1kmmFYZg5qYD0=; b=VfBz7lGsBRYko7k4j20Ux1bx03sh6roz8tjt6s9RgSlxe1tCCT8AZc3mXssvRoAxesqERv PBTgb70uQvEUMZYAd2FqIV/c57AM1DXNr7IBt0ltuLbNBAOtGdqKRwUhtKoLSAApwEpSiX wuKYoAt7sblQLPjCG6dSnTn/xDXMB4cs2QQJWgopt85y583cJxbO0AiVplaIESfnJWaatm qen4b3JjdxR0sPRrngWdXVDpBodoFLbX0Yh2wtg6nFqjLGwhdhxrCu1FkktmR4zfNP5xAm nZMfRmNAne2TyEwPCNZu39zLvBANeepxGl1IVAyqn/A3tDwAHBAVfsOtG1bUAQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1778082711; 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=MCJ8dPcl9O8F1U9fi9QjxgE3L9J53Y1kmmFYZg5qYD0=; b=Ww2oSeXBkZtIgac3US47P85J8TNbdkj7KrBeuIdyR9JhlOOsLCwfjv1sNhscwaW29gB+8I Hj1aNd05SjNanEAg== 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: <177808270902.424702.15175197324777806410.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: 9f6d929ee2c6f0266edb564bcd2bd47fd6e884a8 Gitweb: https://git.kernel.org/tip/9f6d929ee2c6f0266edb564bcd2bd47fd= 6e884a8 Author: Vincent Guittot AuthorDate: Sun, 03 May 2026 12:45:03 +02:00 Committer: Peter Zijlstra CommitterDate: Wed, 06 May 2026 17:41:18 +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))