From nobody Sat Jun 13 21:01: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 C774947F2E8; Tue, 5 May 2026 14:13:32 +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=1777990414; cv=none; b=XrbHTDqaUakYV2P6bj1JntudGwoGAHll8YJEL0dZeLb6/UJ3k5t/3UFiXoD+QWnGBNUgcCMbB/DLw5HCsZy4jZEe4KMgv6/4lyGyrmS6yBv/COtb7F5T7TSBLMVCgYZF47KC3uChvTkkU+avHG+M+bhdyMRyJpvh7hFGFl4aDSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777990414; c=relaxed/simple; bh=atPZ02NI9jDbRSmR4SRdGN6CmKs3ZQTG/TvTdt1ZQx8=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=CVw6IsQ65RpnsUwtFPVejiJZisfS3foxbjMYLpHymejowjq5BsNNKBjPntPd1QkiBiG1PuuSbhH812iIw1LHZpjeihYY63X1qF/uK/+jL4F7drSH4xEFiZg0t9RycYp29+7+QJAnj9CCp9ahEcrzdi0uAXBgiFX0oFuuZRC3nCk= 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=075fKIoK; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ge74//+F; 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="075fKIoK"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ge74//+F" Date: Tue, 05 May 2026 14:13:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777990410; 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=95ty114jFSRcYc65cbaLC+fSy9PzvydRcdJotmEGo8E=; b=075fKIoKxlHW2GYxptdsFbPn3c0/XcyvnbaTRmqNENmxDKTnlSZOXz0YW7cq2rUklcRjDt Kf6Np2VoHhY9f2/MlcpKSmz56rgYASxLNFPy1IKQZ7Dz/r99YJ8yqV151qBO03+EgIV8t/ LAthSO2p4B/b5erS4cB35LWqNQhjMRk6EZ60WZ/Ap4tFXjol7eHa7a7B8PDVYnUNfN2/u+ qTpEIT2ooNmO6DUvP3bhDvtigpqvcfcRdppzprkdwIkyoskiF7Tod9UwplpKFGeeLqPm2V UKFI7imnp/gdZ+OcabPXND2/CubckUeZbw/EiDvwn+fisadxrZOuEWH0K1fYAw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777990410; 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=95ty114jFSRcYc65cbaLC+fSy9PzvydRcdJotmEGo8E=; b=ge74//+FiUV1T93oZJmSGbxfL1QLiP0zYO8VGTX1PsxOx0/mi56L3YwvRwVpLL2rZ+zwAy jnAypsBHT2NIDuCQ== 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: <177799040929.424702.17307255998437068080.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: 0c0cf14be490975a7431e9d49fcd7b190fff337f Gitweb: https://git.kernel.org/tip/0c0cf14be490975a7431e9d49fcd7b190= fff337f Author: Vincent Guittot AuthorDate: Sun, 03 May 2026 12:45:03 +02:00 Committer: Peter Zijlstra CommitterDate: Tue, 05 May 2026 16:03:12 +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))