From patchwork Wed Mar 1 14:17:29 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: 62911 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp3658011wrd; Wed, 1 Mar 2023 06:21:46 -0800 (PST) X-Google-Smtp-Source: AK7set+oDKEgoxDtqmtDCfB1J+zu7uvdCxrEOix776AFAkyLGkxjOMxJevjl2Us/xWQ6PUmhzisA X-Received: by 2002:a17:906:2847:b0:8b1:2c37:ae97 with SMTP id s7-20020a170906284700b008b12c37ae97mr6197013ejc.43.1677680506698; Wed, 01 Mar 2023 06:21:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677680506; cv=none; d=google.com; s=arc-20160816; b=dT7oAnwuC0XPL0wA1YOUMn6IbnsYiCWcgVk1flDIT37ULi0ra8Twz6cLkaWWT8EC6U 50sewItYII39fFSLn7liHl3JtYs1Oowts6nr+P4SfUX1MNXWH5Pd73z7YHRiLLW9pjJT l4IaDiBBonbbzCWvFxl1c9+ajzJKhHHgTG8OItOU8uCcHmnCVdiNiKCCU3PP+9v4gp9j 1X1YBf0UZDCbnYfQ4iKkgL4mSgZBlqnKE7/Hw6r3+TXPUjpE/4myXC+kOEj7Rl7aMYJn NpfMY5nNPGrW35b2tvOEgdZZvgCS03aLVzhP0aaABc0H++449QtHpowEAu3jjFTA+Ofx TX8g== 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=jmOQM9bwoCoHle0ulyYXU2rtf5ilIqCMlhZV0ILFNe8=; b=T46cS5vL1Ml+7ol3R9GjeHrCibwCnROv1pTz8+D3mY3W8OS8fPeADejbeNEREsMhIi ip/nMxLwBgjlkkfaxfEs8MxlG4HI5NMP4f70DcC9IxCyDFe0zABkCutvSHpn8m4YNH6y Dfc7IE4Jz0c1czOiWcV5HAxearmn/RG44ybyU/KXGl2//Lb4a2kmZM8XbGXsUhN/Pbjf dkJgjmj5s6DNjxV6sNttbrEZ5opZWsusRrxzJdf6PjyxhEZEpA04VF8LjcfxvzsoyqTk HghuNEm0x0JTiF7LU9FPBoxjMaCH4sc/r7eFbmD9BCmZPumU164zCEOmlL+5mOe3clsf pzbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Gel4Q84I; dkim=neutral (no key) header.i=@linutronix.de; 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 jx26-20020a170906ca5a00b008cc211391bdsi612318ejb.820.2023.03.01.06.21.22; Wed, 01 Mar 2023 06:21:46 -0800 (PST) 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=Gel4Q84I; dkim=neutral (no key) header.i=@linutronix.de; 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 S230078AbjCAOSR (ORCPT + 99 others); Wed, 1 Mar 2023 09:18:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230045AbjCAOSI (ORCPT ); Wed, 1 Mar 2023 09:18:08 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 348A02A6F7 for ; Wed, 1 Mar 2023 06:18:05 -0800 (PST) From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1677680283; 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=jmOQM9bwoCoHle0ulyYXU2rtf5ilIqCMlhZV0ILFNe8=; b=Gel4Q84I4QAfdW72PCqmjGOQRsi7WJeEFby+cMdun2iQn7RO4ldqyf343ts5pEDP2DOsYB Ilu8sRRYfFX2tkNQsReEpd7By1ZHfZfODrLeAWW/2Eoc04LnVmWNWgEKfi3+69CJ+2SQ08 MiUm290aeVF++k7Ma6nMtUgc+zfOqiiHFpTDOWAwjSRgMZR9aKowwbPVzOZtuP4MkY8//T BLhSoZaTozxF9MIgy2p223DqdGLXKmSCTfNz/V1rF52HfnOtBDPtrqyAC7bH0j9WxlAaca VEQF7pbb5sBc4kc6MHOMTt8ZpJo24x9ejlfCFi99C3tBnycRa1aas0GQOK5kCQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1677680283; 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=jmOQM9bwoCoHle0ulyYXU2rtf5ilIqCMlhZV0ILFNe8=; b=w9ilXrrOvxoN9BykI8dgrEiuqQtwQBSHRfGcZDg4tqdiN4MvkRJpS8KGuveiX2wjRnoSAw GnDfWAX7SSfs2WAg== 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 , Anna-Maria Behnsen Subject: [PATCH v5 03/18] timer: Move store of next event into __next_timer_interrupt() Date: Wed, 1 Mar 2023 15:17:29 +0100 Message-Id: <20230301141744.16063-4-anna-maria@linutronix.de> In-Reply-To: <20230301141744.16063-1-anna-maria@linutronix.de> References: <20230301141744.16063-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 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?1759175514985238018?= X-GMAIL-MSGID: =?utf-8?q?1759175514985238018?= Both call sides of __next_timer_interrupt() store return value directly in base->next_expiry. Move the store into __next_timer_interrupt() and to make 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 --- kernel/time/timer.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index ffb94bc3852f..08e855727ff8 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1803,8 +1803,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; @@ -1870,10 +1872,11 @@ 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; + return; } #ifdef CONFIG_NO_HZ_COMMON @@ -1937,7 +1940,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; /* @@ -2020,7 +2023,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);