From nobody Tue Apr 7 19:55:52 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 A7D0338D01A; Wed, 11 Mar 2026 20:16:27 +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=1773260189; cv=none; b=qkXDZJIaqfP6VtD3rHq2l39t/ftN6rXC0CGHWXel8fHUnblpEudPXqVAqkeEntEoeqDcI0GokTPDeqwdewohm72MLgmAQ/cVfxVuYfVQN14E0YWKW5DvmzZ33Sa1+uqR17uA5qAjDkJpqsbj2sa0N0pBm9TOlamen2PRCaEkmss= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773260189; c=relaxed/simple; bh=z2eA5zJco6niCTvJgmR7IQZlFF6c247ocDP6Mo+9FGg=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=ll3Zn0Vcz0yPXGIl37dvJ91RqaaVwgQUgmqtVkN2YCcE4VmUIi5rx/t+BXtUsgoZwnykZ7U82/QdgrxUipQW5eIq+uwkCdD8cdGUpCIAFDLWwmOxoXJAR0FiPuP2mZd4mq5mlLu2k6AjizcFupgnG+tu2ZkpfHuj2ehG676JubY= 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=eqTIv2rp; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=JwgdCFxy; 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="eqTIv2rp"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="JwgdCFxy" Date: Wed, 11 Mar 2026 20:16:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773260185; 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=bnHFcynqrzGS3rzccyjw+Xo2zx4ZCDcQULbpkonSK6Q=; b=eqTIv2rpBKM/lQtDc0Yc6MUdZdHGNPHImopzc7p4qyUQGmmbSMCCTf4csGA6OmvS42t4qZ 57olT25YgbfoJkNxMCfDRqy1Fjc3qRSptYHGgr7noX+iKq6z8gzWnoDw/WSZ8es+tqQ1Oh Kk0Zb45iJkyeQuOCm17zDGOoYFTS9NJDYc4oT3s8Q2DA9+RbklqZ5MowZ5o4v7daVIyAC0 mxaVJauo2xmh25Pvd+MygH2uSPec4zFi3KXlmKhXDapzoVLjC84v7dAfNfJuObm+y002Of hs8O55Yy4G3+r6r1MA2NoEjZaJPHEDIEvQJyeCgJVWCbxCg5ERA5SYYjaeZCZQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773260185; 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=bnHFcynqrzGS3rzccyjw+Xo2zx4ZCDcQULbpkonSK6Q=; b=JwgdCFxy531kMwmtW/uc4xo74sE2SsTumGbtvr0XNsxZezv8tkCU8V6+1JW0RQbpTNMZ6D SFyvuH4tvb/y12Dg== 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/hrtick] hrtimer: Less agressive interrupt 'hang' handling Cc: kernel test robot , "Peter Zijlstra (Intel)" , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260311121500.GF652779@noisy.programming.kicks-ass.net> References: <20260311121500.GF652779@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: <177326018331.1647592.701872663652785473.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/hrtick branch of tip: Commit-ID: 92f7ee408c23fcc074e4952fb6ffacdf3eb86b56 Gitweb: https://git.kernel.org/tip/92f7ee408c23fcc074e4952fb6ffacdf3= eb86b56 Author: Peter Zijlstra AuthorDate: Tue, 10 Mar 2026 20:02:21 +01:00 Committer: Thomas Gleixner CommitterDate: Wed, 11 Mar 2026 21:13:55 +01:00 hrtimer: Less agressive interrupt 'hang' handling When the hrtimer_interrupt needs to restart more than 3 times and still has expired timers, the interrupt is considered hung. To give the system a little time to recover, the hardware timer is programmed a little into the future. Prior to commit 288924384856 ("hrtimer: Re-arrange hrtimer_interrupt()"), this was relative to the amount of time spend serving the interrupt with a max of 100 msec. However, in order to simplify, and because this condition 'should' not happen, the timeout was unconditionally set to 100 msec. 'Obviously' there is a benchmark that hits this hard, by programming a ton of very short timers :-/ Since reprogramming is decoupled from the interrupt handling, the actual execution time is lost, however the code does track max_hang_time. Using that, rather than the 100 ms max restores performance. stress-ng --timeout 60 --times --verify --metrics --no-rand-seed --timerm= ix 64 bogo ops/s 288924384856^1: 23715979.93 288924384856: 11550049.77 patched: 23361116.78 Additionally, Thomas noted that cpu_base->hang_detected should not be cleared until the next interrupt, such that __hrtimer_reprogram() won't undo the extra delay. Fixes: 288924384856 ("hrtimer: Re-arrange hrtimer_interrupt()") Reported-by: kernel test robot Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260311121500.GF652779@noisy.programming.ki= cks-ass.net Closes: https://lore.kernel.org/oe-lkp/202603102229.74b9dee4-lkp@intel.com --- kernel/time/hrtimer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index b94bd56..cafd677 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -2031,8 +2031,8 @@ static void hrtimer_rearm(struct hrtimer_cpu_base *cp= u_base, ktime_t expires_nex * Give the system a chance to do something else than looping * on hrtimer interrupts. */ - expires_next =3D ktime_add_ns(ktime_get(), 100 * NSEC_PER_MSEC); - cpu_base->hang_detected =3D false; + expires_next =3D ktime_add_ns(ktime_get(), + min(100 * NSEC_PER_MSEC, cpu_base->max_hang_time)); } hrtimer_rearm_event(expires_next, deferred); } @@ -2121,6 +2121,7 @@ retry: */ now =3D hrtimer_update_base(cpu_base); expires_next =3D hrtimer_update_next_event(cpu_base); + cpu_base->hang_detected =3D false; if (expires_next < now) { if (++retries < 3) goto retry;