From nobody Sun Feb 8 18:31:49 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 7E74E328263; Thu, 15 Jan 2026 21:01:07 +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=1768510868; cv=none; b=hs+8cQqY47/i6HuJZ9ODyd9C/CuEQ4HuqaVfcaeDRuz1i/+mAJQ1XUJAS8rC2ToF+k0liGjLWxS/ZrmN8N7itw+YXhOrSWwJZwXln+Nv7O3V3YX7WYW2MrN7LerKJ45/Ql6mjwKfFF2QLhwVyTy8caDrhmTMGFNdRx2ByP7sBnU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768510868; c=relaxed/simple; bh=bcqwIf0KHrelfMZv0YcMpkK7Hrvl1i9nkQj2ruW/8F8=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=WyyZSunbyhLZhLAsx/mF/PrCSLEYQdOxQJhtIHCwjmFLRT4ZxS0yug5MTHEiIxrqL6aIhxKwmoiYkWk0i0X8oUMnigDxwaIrCj/9r1TYLlDEpIeA5t0vBtiQBCZm7BfNW3+GfOzzBfNchITrjbI89p6qPYQyqkEWHsxWSe0XCg0= 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=WLEr7Hwr; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=mFTMij14; 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="WLEr7Hwr"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mFTMij14" Date: Thu, 15 Jan 2026 21:01:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1768510865; 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=elDq9ijNLlIplF++CMPcIf3+aodvqBSs3Q6JR9X+fgY=; b=WLEr7Hwr41nhDmceCZeQpaEQ/D0d87v3Ual/K80Yc5L3Doc9PEvIAWWwcNiBiXZ0w94PSP qp5XO47cPQTo9NqdT2kQq+R/DsrOhhhrNoLK/9LEPh80kVB90kS+DVujDnP60AD69lunom xexSaQ8Z11NW14qxUTVU5aweBJXINtEHYw6+7C9zSsdXbpA3O4IqkOQs6BvDlHOvAZvsZu fMjF/dj6JWu5EFo/EVvCa6396HEO07mYoB3AGqG1nNh7YpdIOZ9gJiL+JQTqBU/MkMDdAL 5dsgcabAWk2kKyde4wnk6KKAk+cVrMJZX6Fr94H9cuUmMsYRvKPAIKGzxFg3Jw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1768510865; 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=elDq9ijNLlIplF++CMPcIf3+aodvqBSs3Q6JR9X+fgY=; b=mFTMij14qRW1OsnguSXDslNsr4NzHVsJufuR4oP7G8mhwSxUcHFjOFpyxx8j/lR3DwFvdp zz4tdAkMMX+380Cw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/urgent] sched/deadline: Ensure get_prio_dl() is up-to-date Cc: K Prateek Nayak , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260106104113.GX3707891@noisy.programming.kicks-ass.net> References: <20260106104113.GX3707891@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 Message-ID: <176851086404.510.18122560875480513196.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: 375410bb9a403009a44af3cc7f087090da076e09 Gitweb: https://git.kernel.org/tip/375410bb9a403009a44af3cc7f087090d= a076e09 Author: Peter Zijlstra AuthorDate: Tue, 06 Jan 2026 11:41:13 +01:00 Committer: Peter Zijlstra CommitterDate: Thu, 15 Jan 2026 21:57:52 +01:00 sched/deadline: Ensure get_prio_dl() is up-to-date Pratheek tripped a WARN and noted the following issue: > Inspecting the set of events that led to the warning being triggered > showed the following: > > systemd-1 [008] dN.31 ...: do_set_cpus_allowed: set_cpus_allowed beg= in! > > systemd-1 [008] dN.31 ...: sched_change_begin: Begin! > systemd-1 [008] dN.31 ...: sched_change_begin: Before dequeue_task()! > systemd-1 [008] dN.31 ...: update_curr_dl_se: update_curr_dl_se: ENQ= UEUE_REPLENISH > systemd-1 [008] dN.31 ...: enqueue_dl_entity: enqueue_dl_entity: ENQ= UEUE_REPLENISH > systemd-1 [008] dN.31 ...: replenish_dl_entity: Replenish before: 14= 815760217 > systemd-1 [008] dN.31 ...: replenish_dl_entity: Replenish after: 148= 16960047 > systemd-1 [008] dN.31 ...: sched_change_begin: Before put_prev_task(= )! > > systemd-1 [008] dN.31 ...: sched_change_end: Before enqueue_task()! > systemd-1 [008] dN.31 ...: sched_change_end: Before put_prev_task()! > systemd-1 [008] dN.31 ...: prio_changed_dl: Queuing pull task on pri= o change: 14815760217 -> 14816960047 > systemd-1 [008] dN.31 ...: prio_changed_dl: Queuing balance callback! > systemd-1 [008] dN.31 ...: sched_change_end: End! > > systemd-1 [008] dN.31 ...: do_set_cpus_allowed: set_cpus_allowed end! > systemd-1 [008] dN.21 ...: __schedule: Woops! Balance callback found! > > 1. sched_change_begin() from guard(sched_change) in > do_set_cpus_allowed() stashes the priority, which for the deadline > task, is "p->dl.deadline". > 2. The dequeue of the deadline task replenishes the deadline. > 3. The task is enqueued back after guard's scope ends and since there is > no *_CLASS flags set, sched_change_end() calls > dl_sched_class->prio_changed() which compares the deadline. > 4. Since deadline was moved on dequeue, prio_changed_dl() sees the value > differ from the stashed value and queues a balance pull callback. > 5. do_set_cpus_allowed() finishes and drops the rq_lock without doing a > do_balance_callbacks(). > 6. Grabbing the rq_lock() at subsequent __schedule() triggers the > warning since the balance pull callback was never executed before > dropping the lock. Meaning get_prio_dl() ought to update current and return an up-to-date value. Fixes: 6455ad5346c9 ("sched: Move sched_class::prio_changed() into the chan= ge pattern") Reported-by: K Prateek Nayak Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: K Prateek Nayak Tested-by: K Prateek Nayak Link: https://patch.msgid.link/20260106104113.GX3707891@noisy.programming.k= icks-ass.net --- kernel/sched/deadline.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index b5c19b1..b7acf74 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -3296,6 +3296,12 @@ static void switched_to_dl(struct rq *rq, struct tas= k_struct *p) =20 static u64 get_prio_dl(struct rq *rq, struct task_struct *p) { + /* + * Make sure to update current so we don't return a stale value. + */ + if (task_current_donor(rq, p)) + update_curr_dl(rq); + return p->dl.deadline; } =20