From nobody Sun Jun 14 11:29: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 179773C6A44; Thu, 2 Apr 2026 11:46:36 +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=1775130406; cv=none; b=nI4x6Vf4MzXnGoQtSHCJs+5XyPgxX8Ye/Zv+zd3hbqA2jXHYUOEofhEV1SpoY/Zn53iIk8R/Na/9Xqy7ZniKbzgpr+6IiXKVtTL4GDIqxujSDJS1/D7RLNk8IlMqTJbx88xQAMHDfTcGRFRtgME2edeYfz8HKjMzL2Y9/wYuQyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775130406; c=relaxed/simple; bh=Ba5ky5GgAgHq9QsoVr2sm81hPZICNUMjh+xWcqjT42A=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=Nq2mAdRw9F48MQrXM/QVmRpf+7LAnkIIimjHJogwt5jwujR88rhwGy9GdskdoU90DGrtltq/8KbZPwzr4Uc7O8eyBULPki3lT69tG0VkvEw9gO4TFffZNRVvmBVovtWimLYVA5kFyEIund68mzLUdDmyEuVczEI6HIsQV4NGWkw= 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=j4Ltpwsi; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=xNRLqjj2; 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="j4Ltpwsi"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="xNRLqjj2" Date: Thu, 02 Apr 2026 11:46:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1775130388; 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=cu2VNz3rK2NEMZqE1/iYrQwheaCt68ln7I6OATdwXcI=; b=j4LtpwsildN8uEjiKyzSX/OMMHNgLT+1+4EUIky24/3n1eRO0dYutTFHZt8cFIZX0SpqLP MRQTpqqREgEuWITDJBUiFCYv36HGDScphjeT4B8XuqmBBdVDk/o57IpZdmmm+EotS8Gb/K dKroHmwlfdXqyeNVi2xCjAX238qsrrrxB3sdPWVnb8F2X7MnTEM3693d5Q/2RKUcD8oiAX DVNg+pDn+QzGzaLBwT+7fChHxd9PnlEv4NbF2x0Qw8OGsDlhS7B3J0R9xyP4Q1gfuj3FA2 Sd6U89Wgue9JOvzmzIvm8YxxjwcHvuByIH67WBLo/y05crMjKO1/uZfDLuBDnA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1775130388; 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=cu2VNz3rK2NEMZqE1/iYrQwheaCt68ln7I6OATdwXcI=; b=xNRLqjj2H9/mm3iZ7zrirRLcPcmT/TkYL26YG4R706IWdOs8bH6GUKuunJ8AKK9ZnyRCsB Wde4Sco8yYXAHBAw== 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/debug: Fix avg_vruntime() usage Cc: John Stultz , "Peter Zijlstra (Intel)" , Vincent Guittot , K Prateek Nayak , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260401132355.196370805@infradead.org> References: <20260401132355.196370805@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177513038242.1647592.13373222210230548295.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: e08d007f9d813616ce7093600bc4fdb9c9d81d89 Gitweb: https://git.kernel.org/tip/e08d007f9d813616ce7093600bc4fdb9c= 9d81d89 Author: Peter Zijlstra AuthorDate: Wed, 01 Apr 2026 15:20:21 +02:00 Committer: Peter Zijlstra CommitterDate: Thu, 02 Apr 2026 13:42:43 +02:00 sched/debug: Fix avg_vruntime() usage John reported that stress-ng-yield could make his machine unhappy and managed to bisect it to commit b3d99f43c72b ("sched/fair: Fix zero_vruntime tracking"). The commit in question changes avg_vruntime() from a function that is a pure reader, to a function that updates variables. This turns an unlocked sched/debug usage of this function from a minor mistake into a data corruptor. Fixes: af4cf40470c2 ("sched/fair: Add cfs_rq::avg_vruntime") Fixes: b3d99f43c72b ("sched/fair: Fix zero_vruntime tracking") Reported-by: John Stultz Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Vincent Guittot Tested-by: K Prateek Nayak Tested-by: John Stultz Link: https://patch.msgid.link/20260401132355.196370805@infradead.org --- kernel/sched/debug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index b24f40f..15bf45b 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -902,6 +902,7 @@ static void print_rq(struct seq_file *m, struct rq *rq,= int rq_cpu) void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) { s64 left_vruntime =3D -1, zero_vruntime, right_vruntime =3D -1, left_dead= line =3D -1, spread; + u64 avruntime; struct sched_entity *last, *first, *root; struct rq *rq =3D cpu_rq(cpu); unsigned long flags; @@ -925,6 +926,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct c= fs_rq *cfs_rq) if (last) right_vruntime =3D last->vruntime; zero_vruntime =3D cfs_rq->zero_vruntime; + avruntime =3D avg_vruntime(cfs_rq); raw_spin_rq_unlock_irqrestore(rq, flags); =20 SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "left_deadline", @@ -934,7 +936,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct c= fs_rq *cfs_rq) SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "zero_vruntime", SPLIT_NS(zero_vruntime)); SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "avg_vruntime", - SPLIT_NS(avg_vruntime(cfs_rq))); + SPLIT_NS(avruntime)); SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "right_vruntime", SPLIT_NS(right_vruntime)); spread =3D right_vruntime - left_vruntime;