Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp480181rdb; Thu, 22 Feb 2024 09:24:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWdi5X95uRNhmpVuarImrefftt3AjoEBKXnSTtXQc6+r5qf4GIWb+DXnZVxxA6Api/sdKpz901ft6rN1Ph2qXBxEAFsq+qUizz1XQszFQ== X-Google-Smtp-Source: AGHT+IEGKgfgUuFhvV/N0JHKSVMMVpQqVEFv3O6IdrVHIkcrzcswMzHkm7e5OITzyx10p97K1rgI X-Received: by 2002:a17:906:2b05:b0:a3f:4bcf:4ded with SMTP id a5-20020a1709062b0500b00a3f4bcf4dedmr3444687ejg.37.1708622649285; Thu, 22 Feb 2024 09:24:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708622649; cv=pass; d=google.com; s=arc-20160816; b=Z5yFdBWpGgZsS+c3cmG+eHQGk8+zsdmNkqc9cLaXqBTCk/PxM12IhiiBer1EzESkBx ST5IX8gDXTyaRS18T0Ygpm7DuNsh4qe18IQS/7vjojUBto/YKgXibMI+qBKETx1pPgvX L/weykkr5BzIQSpkjgjT06YEgcaRrdxw7VXQjPREJRWbfzR2KobSWjIluZPfbtCLEWvL vPpBHrY1HKG2VVHxnNxLsSt4ORuR6KdMF/Z9+x8/oA/sXMYOBe9g/TMOoCslCH09Ss0E PdTa5nYIfRbMGFUxR2QKTQsEtCwPOUfO4FslJaBy5nXe/yF5F8Y4hgSovCQbsDcWQMah dpeQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=aPuKscbLmQCwJejxlBLH7lYZEv+GBgNpH9gNdQbiykI=; fh=IdquJyaazQ3wXWxdOExnpctJRLX4Jw3HEb/tnyKonzY=; b=P/FJWQxzdn8WMYX7BhSBCq/VcJFPS4BWbkKeokq5JBsCaebuiy8LbTZ+eqETf6rXDu fYS/LQhYx7Li8PIsLaSKXjmAz+awO3XFoyoUZKOlX72FzpwePgXdSn2JQjeZeca/YAPb 95sQVowT2XU2td+xb+ahQMyDQ9ObgD/cDH6mwDQy39wG+/SrfSL09GAKSWQ2lJZQuatQ i7j8k4n9CFanP/bOZXg+ICmM7N7qjHWdmb4Nfq4evY+471uoEGkNKntWldJINrzJiado MSvVTjT1HoQJgqsDpKyE8DtTUA8LLw9AlGCTNNGCVcFrNLOR5qzKEF+O78FvltElOhTc PoOA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=iqU4AIn6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-76943-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76943-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id l7-20020a1709060e0700b00a3e8b7e5650si3938144eji.291.2024.02.22.09.24.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:24:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76943-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=iqU4AIn6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-76943-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76943-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 566E21F29D05 for ; Thu, 22 Feb 2024 17:13:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD4C5158D7D; Thu, 22 Feb 2024 17:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="iqU4AIn6"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ySaNGDEz" 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 45220156998; Thu, 22 Feb 2024 17:12:14 +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=1708621937; cv=none; b=A/2Ab8ZYUn0N4fAviSZYolTROnjtbXWTYKqYZCo/JXtOHfApMW20JWq75fFZeJqHqbz0cWqAIaYrjrtDWWfMIjUhu6EImgzY6nWBYR29rRaLu7rp3oTPN5UJ3jYy53W6fCve8tH7uvsuQN2OXK2zwb8qSVqndND43RmytfxqIQ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708621937; c=relaxed/simple; bh=MfWuiBK/m+NRYyBOunvmpucUCdyGR+jmSrElFB303iI=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=GBG6Y4W/FRhSTu6OMsPtH98+6tRKLyuQexFl1K7o+kE9dI2PrDP6PkGER/d0M8bQqTTtkEsxm4qBavHOMr1sLBz6qoaA4xMEk1th7R/2FBWzQNb0ft3OLXE4qqR9GbXRrt12tafPOMvjB0Wd15sYeyGm/fRaln+vjt/4DLGO9uU= 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=iqU4AIn6; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ySaNGDEz; 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 Date: Thu, 22 Feb 2024 17:12:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708621933; 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=aPuKscbLmQCwJejxlBLH7lYZEv+GBgNpH9gNdQbiykI=; b=iqU4AIn6NrLUDRh/XraKAdf7e4doCPx/ac0uermHBSDG5Ik0R24oRtIszDX97NTVsaM9Mn Lhfr1zFX0W8uRU4yOVKe4ld0aXxlpVqJBnH/BwY+ojpTn5oR5ooT+isz/YQOHi+ednpM8G gKzVOln8GZpQ7GPTYRcUp3WOMku5oKcm6wob8nujiJ8hVg5czFj7q458IHtfrsZKadd3ce CkvesNCibWWdkINlVOjY87vsd6MZG3Ao10fHlMxeEOBtKpThkWo17TEbg0IURESoF6dsEx LZNa74rT/G/vxQ91ZK/q5xVRY7x/ebQnEHDjvF9VVHn2fo9mM8li5fFdRu09SA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708621933; 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=aPuKscbLmQCwJejxlBLH7lYZEv+GBgNpH9gNdQbiykI=; b=ySaNGDEzo81eZ42r64yUiksG6+9V7Kqect3ydlvByKdoKhbYUqH7ZUEgxR1iKqLo79xZCl JYGgEdR3HQyYbrDA== From: "tip-bot2 for Anna-Maria Behnsen" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] timers: Simplify code in run_local_timers() Cc: "Anna-Maria Behnsen" , Thomas Gleixner , Frederic Weisbecker , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240221090548.36600-9-anna-maria@linutronix.de> References: <20240221090548.36600-9-anna-maria@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170862193261.398.16190156400027177660.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: 7bit The following commit has been merged into the timers/core branch of tip: Commit-ID: af68cb3fc736e13e66fc8202ea94c3aff7299f39 Gitweb: https://git.kernel.org/tip/af68cb3fc736e13e66fc8202ea94c3aff7299f39 Author: Anna-Maria Behnsen AuthorDate: Wed, 21 Feb 2024 10:05:36 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 22 Feb 2024 17:52:31 +01:00 timers: Simplify code in run_local_timers() The logic for raising a softirq the way it is implemented right now, is readable for two timer bases. When increasing the number of timer bases, code gets harder to read. With the introduction of the timer migration hierarchy, there will be three timer bases. Therefore restructure the code to use a loop. No functional change. Signed-off-by: Anna-Maria Behnsen Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker Link: https://lore.kernel.org/r/20240221090548.36600-9-anna-maria@linutronix.de --- kernel/time/timer.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 121f5b9..9c8443d 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -2180,16 +2180,14 @@ static void run_local_timers(void) struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); hrtimer_run_queues(); - /* Raise the softirq only if required. */ - if (time_before(jiffies, base->next_expiry)) { - if (!IS_ENABLED(CONFIG_NO_HZ_COMMON)) - return; - /* CPU is awake, so check the deferrable base. */ - base++; - if (time_before(jiffies, base->next_expiry)) + + for (int i = 0; i < NR_BASES; i++, base++) { + /* Raise the softirq only if required. */ + if (time_after_eq(jiffies, base->next_expiry)) { + raise_softirq(TIMER_SOFTIRQ); return; + } } - raise_softirq(TIMER_SOFTIRQ); } /*