From nobody Mon Jun 8 07:24:35 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 78B9F3D0C1D; Thu, 4 Jun 2026 18:45:35 +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=1780598737; cv=none; b=AHqiTy+t3vbjQiKCdENlPeX8urRBvvY6g1ezvzGiOo8Tm3m0Tqpo6RehrigVIZS4n3c0mDOnIuaBl2hMmfN6PCn/z71KemV6d3NVPctkZpmTV/HvZ0ZssO5F6kJxM5DVwMW+YsIqllQ62w+50NYKAJZZpLENmGbIyAEHMHyCe0c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780598737; c=relaxed/simple; bh=2KJO53Ry5j8pIpQzibGsQLOeNUgH9acH2pOBV9Pf7fs=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=I3tj7yCUhsbsfEXlVVZPoBwdsmzMQ1zO/iiGqjY6F9XNUZZkuVCQ//pb8eWdPnUBE1UHMpkERIR/X2P1noz8YUXnL+vv+2pTsE90VWtiPIfNBhyyc7SGk9ycQI8h8j6Th6zB1CSZGxMEpeZ1m2ZDwBXm/D5dZVCqwitQ50wDrCU= 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=XkQkQa4g; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=4I2DyXBc; 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="XkQkQa4g"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="4I2DyXBc" Date: Thu, 04 Jun 2026 18:45:32 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780598734; 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=rMXSw8tr09yUAuc372XtZUdx9ZwnPrbWR28DB+wTb0c=; b=XkQkQa4g9FjuMrJS/rSeLySoeKcQnyWiIbQuRvbq9wfhLvH2QoFMVAuTve3KqR5FGkSla7 E5zo1ElVMaD+BGKct2wmDASENYp6NgiVP30KQLGvsr72OwxHNgDZXYD0u4aDK5GUjbuUkM 1q9bcoHG1DqBjiIlpeFnOTlvDu2+vv3F++5Sc/xUjpbyptnE9ri8BxDr3bTv07QI8SsXE5 isthQBsgZsY/Np3KjkDpcKuY9cn75UfiQjOxjCGJqjoQwOlAsjrQ3ASdSkGnIokybO+zwI u/h5KoZzbgvLIs1bOvCJpbnkIg/3xOzfx1byGhc6VkzySGhIx+kdmJVNS7SCxg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780598734; 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=rMXSw8tr09yUAuc372XtZUdx9ZwnPrbWR28DB+wTb0c=; b=4I2DyXBclWxhTJZN8URZzO+bwds9R5dcTEAXJfH1NMFcL25B4hNRtFlIBNTXI380+ClvrL Yfr2o+9nmL4EVqAw== From: "tip-bot2 for Guanyou.Chen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched: restore timer_slack_ns when resetting RT policy on fork Cc: "Qiaoting.Lin" , "Guanyou.Chen" , "Chunhui.Li" , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260522131000.1664983-2-chenguanyou@xiaomi.com> References: <20260522131000.1664983-2-chenguanyou@xiaomi.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178059873259.710.9910245395140681179.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/core branch of tip: Commit-ID: 63c1a12bc0e09af7dee919c4fb4a300a719d5125 Gitweb: https://git.kernel.org/tip/63c1a12bc0e09af7dee919c4fb4a300a7= 19d5125 Author: Guanyou.Chen AuthorDate: Fri, 22 May 2026 21:09:59 +08:00 Committer: Peter Zijlstra CommitterDate: Tue, 02 Jun 2026 12:26:10 +02:00 sched: restore timer_slack_ns when resetting RT policy on fork Commit ed4fb6d7ef68 ("hrtimer: Use and report correct timerslack values for realtime tasks") sets timer_slack_ns to 0 for RT tasks in __setscheduler_params(). However, when an RT task with SCHED_RESET_ON_FORK creates child threads, the children inherit timer_slack_ns=3D0 from the parent. sched_fork() resets the child's policy to SCHED_NORMAL but does not restore timer_slack_ns, leaving the child permanently running with zero slack. Fix this by restoring timer_slack_ns from default_timer_slack_ns in sched_fork() when resetting from RT/DL to NORMAL policy, matching the existing behavior in __setscheduler_params(). Note: this fix alone requires a correct default_timer_slack_ns to be effective. See the following patch for that fix. Fixes: ed4fb6d7ef68 ("hrtimer: Use and report correct timerslack values for= realtime tasks") Reported-by: Qiaoting.Lin Signed-off-by: Guanyou.Chen Signed-off-by: Chunhui.Li Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260522131000.1664983-2-chenguanyou@xiaomi.= com --- kernel/sched/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 5a317f6..2cfe893 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4826,6 +4826,7 @@ int sched_fork(u64 clone_flags, struct task_struct *p) p->policy =3D SCHED_NORMAL; p->static_prio =3D NICE_TO_PRIO(0); p->rt_priority =3D 0; + p->timer_slack_ns =3D p->default_timer_slack_ns; } else if (PRIO_TO_NICE(p->static_prio) < 0) p->static_prio =3D NICE_TO_PRIO(0); =20