From patchwork Wed May 24 07:06:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna-Maria Behnsen X-Patchwork-Id: 98329 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2650183vqo; Wed, 24 May 2023 00:09:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5GQWnxYEtZafF5x8jLjUFiW0i+eiMbsMSFR+lGsUWNrpEnt33DkCt2INjLjxObVvkz8nt6 X-Received: by 2002:a05:6a00:391b:b0:64d:632a:d0ac with SMTP id fh27-20020a056a00391b00b0064d632ad0acmr1910066pfb.25.1684912151059; Wed, 24 May 2023 00:09:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684912151; cv=none; d=google.com; s=arc-20160816; b=ETrKzTupz65/ipLsAKWCsVWOuh+8gXPSypcgRAw9PLDn0ZUF3mk2b8tiBnqlSgor9u s9bc5tO2iv2wi3gs0KuiciFYwhthcjOaVGT+D5lMFT6EwqkQE5uBvMfNXD6j6vQ2QHNj QwAM2SVhj9kvWzo4NewGcHatJlf2M55C6bcJghQ/VOBz3GR3O74vRKuqZYGW707USEHG boRURleuNmzYIuogc7u1wD2fcZpxAIjgQyVSCxWhjiDRteIT24jcQwQoxcHVgOXPPXBX tVl/f4EvWR0IfjVElPnIwzBTsozwmRTJ3FAvxfeAnOH3qkkN9ARW7Ca0zWvR7iW7bPeq LBrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=zI+0rerNf99sxfZIFO3XWHcHmkxmJchxL7sCWUUXfOI=; b=LqsWNy58Uah8QaumFYLFy/5sRS2Ji8W5P7/QrkQycchV1Ip1UlnliC+fvqaP0ASjNR LSieS1+XGwURsM4D2LrM6Q1SZjJ+1n2GUAM/EoIDq0rNOGJPdXfzfICLo3Gt7hepX+bP l4pL4R+XNl9X1YcnY/AaCGqD6/MJfL5zx+ppkxs6BgP24OxO4BaXQ3obX+p062oPdt+c RibLA0QoIWkDlSjWH/GefZ4+GcqH7Qd58z/TLKJFXHrbCMVtzq+ju+yUcMOw87tX4uDk QNSBBalmBuD7gy3eX9XGrF96Lflp4VhoWT2o06sB2ejtTzQPagsH5JVzlzqd0+UkahhK oJuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Wr2VyIci; dkim=neutral (no key) header.i=@linutronix.de header.b=aFOpeYDb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b21-20020aa79515000000b00643a2b0c6c8si6116887pfp.106.2023.05.24.00.08.58; Wed, 24 May 2023 00:09:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Wr2VyIci; dkim=neutral (no key) header.i=@linutronix.de header.b=aFOpeYDb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239869AbjEXHHR (ORCPT + 99 others); Wed, 24 May 2023 03:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239779AbjEXHHC (ORCPT ); Wed, 24 May 2023 03:07:02 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09269A1 for ; Wed, 24 May 2023 00:06:58 -0700 (PDT) From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684912017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zI+0rerNf99sxfZIFO3XWHcHmkxmJchxL7sCWUUXfOI=; b=Wr2VyIci+1KGANfU0hvgLY2W+RSW/uSFDqAG77CiZcGF0EX+8Inx/EeYDJH+qjjSC8b6u+ tyqo9DnQDvUCdpqpmAKjoSCK+FKETKHw5EuoZDNVyXHSjkN3qTvVcuGlkhh5R4yIB51de2 wPcsDoNmoMU/4U1PA2fmlWPi+HN6cTR3QdWsWUezlXzif/XSTdXnx0rn0HbtvjGKXWyr/H T+e+bFO5iliSvLB65XRgUQeBow/Fb8D9yNEjA0UjpwWVm8Ju0aLrGJVzDiMd3hA/AV4fY0 ncyhUIgJ7Irw06WRJnciyIIflNFvAdX0chwhZsHYgkrd4VEVS5TbPgB6/8h3yA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684912017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zI+0rerNf99sxfZIFO3XWHcHmkxmJchxL7sCWUUXfOI=; b=aFOpeYDb/IZ7oNaaLSwyRIRSdcLlye2JIH4mnkGNUr1VsXgheAXY8TzfHIZuEhN8Ih0q6W p0sc0DN6o98G3+CA== To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , John Stultz , Thomas Gleixner , Eric Dumazet , "Rafael J . Wysocki" , Arjan van de Ven , "Paul E . McKenney" , Frederic Weisbecker , Rik van Riel , Steven Rostedt , Sebastian Siewior , Giovanni Gherdovich , Lukasz Luba , "Gautham R . Shenoy" , Anna-Maria Behnsen , Frederic Weisbecker Subject: [PATCH v7 04/21] timer: Move store of next event into __next_timer_interrupt() Date: Wed, 24 May 2023 09:06:12 +0200 Message-Id: <20230524070629.6377-5-anna-maria@linutronix.de> In-Reply-To: <20230524070629.6377-1-anna-maria@linutronix.de> References: <20230524070629.6377-1-anna-maria@linutronix.de> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766758444063086228?= X-GMAIL-MSGID: =?utf-8?q?1766758444063086228?= Both call sites of __next_timer_interrupt() store return value directly in base->next_expiry. Move the store into __next_timer_interrupt() and to make its purpose more clear, rename function to next_expiry_recalc(). No functional change. Signed-off-by: Anna-Maria Behnsen Reviewed-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker --- v6: Fix typos in commit message and drop not required return as suggested by Peter Zijlstra) v4: rename function as suggested by Frederic Weisbecker --- kernel/time/timer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 0699fd14d00a..59f2e15733ab 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1800,8 +1800,10 @@ static int next_pending_bucket(struct timer_base *base, unsigned offset, /* * Search the first expiring timer in the various clock levels. Caller must * hold base->lock. + * + * Store next expiry time in base->next_expiry. */ -static unsigned long __next_timer_interrupt(struct timer_base *base) +static void next_expiry_recalc(struct timer_base *base) { unsigned long clk, next, adj; unsigned lvl, offset = 0; @@ -1867,10 +1869,9 @@ static unsigned long __next_timer_interrupt(struct timer_base *base) clk += adj; } + base->next_expiry = next; base->next_expiry_recalc = false; base->timers_pending = !(next == base->clk + NEXT_TIMER_MAX_DELTA); - - return next; } #ifdef CONFIG_NO_HZ_COMMON @@ -1934,7 +1935,7 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem) raw_spin_lock(&base->lock); if (base->next_expiry_recalc) - base->next_expiry = __next_timer_interrupt(base); + next_expiry_recalc(base); nextevt = base->next_expiry; /* @@ -2017,7 +2018,7 @@ static inline void __run_timers(struct timer_base *base) WARN_ON_ONCE(!levels && !base->next_expiry_recalc && base->timers_pending); base->clk++; - base->next_expiry = __next_timer_interrupt(base); + next_expiry_recalc(base); while (levels--) expire_timers(base, heads + levels);