From patchwork Tue Oct 25 13:58:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anna-Maria Behnsen X-Patchwork-Id: 10803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1025202wru; Tue, 25 Oct 2022 07:03:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7lpk0+beNfzjkEr3Suo/RkGnqsU2ORceBj8x7Q8jWeAa2mNg2BA9Gpcl9eIU3dT5YwjQ3u X-Received: by 2002:a17:907:7f92:b0:78d:ed9c:d86f with SMTP id qk18-20020a1709077f9200b0078ded9cd86fmr32711088ejc.251.1666706629541; Tue, 25 Oct 2022 07:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666706629; cv=none; d=google.com; s=arc-20160816; b=gLazfCbpYLKHkFblxsnYfkamPasAolXNdE0KQvwPrSX4evSRgHw0fgHzcRULHXXZFw 2Uc3U800APVpWeNajp70i21QhIfLRmReqjT/x8pvGMdYYaiNaeikHDcSl4UK2cgY34Lt 8K4Lw/u7oBXko0sqdWAGIZNljOnoCCYD7zvPpINvLorAuSUtqNajneuLOkUYFIfywN45 DRuOMe1vKiu/K0WAUVlxC+34JLULb7OThEvZcD9ZApzSu6ZdhhBifcU5EEO528YGU6P2 oOFk8Pv0LMmg4YYYxzy07hQt4PlM6zaNFOBP515K2fsCNWLoKj/ENI0iQ+tVMcIl/gAu 7HyA== 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=I9KrkHTSRk9elfiy6IejGCtNRlCE++/FB5CiuBByAlk=; b=sDjQ1fz49lwSq7Vv11CxScyLQojYOB8bu1NVkSI4DYKcHUmgJHbtJcGFbmu4AZOjNy 3VTuK07DdTdvvLfwgstPvnngqMwWM57Fk8T29VUP85iy4gAyN7p5QDmDnkHsCAmWj0aO 33c1edrMFQ4BV2mnT5ICmKLjXQtV8uYDlVt+YVAakWNC4xLcR3V7WgO5H/g2HXXpbz9H tCD4SinAzjit8Fg9i5T70yOqHWuoHgBboZCB/GBvAU56z8fYmre9Jb3Byh65AmLx2ZIV 7wK3pVUMYKTxe7yDlmIalRS4hXw5Ena09xgPcR0sPDI+JTywcdcG6hvTcnNQm2+FYecD zFzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b="Tf/9SYQH"; dkim=neutral (no key) header.i=@linutronix.de header.b=OOxPYlfB; 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 d23-20020aa7c1d7000000b0046194b2dd53si2675490edp.119.2022.10.25.07.03.24; Tue, 25 Oct 2022 07:03:49 -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="Tf/9SYQH"; dkim=neutral (no key) header.i=@linutronix.de header.b=OOxPYlfB; 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 S232288AbiJYN7o (ORCPT + 99 others); Tue, 25 Oct 2022 09:59:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231526AbiJYN7Z (ORCPT ); Tue, 25 Oct 2022 09:59:25 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 371C13BB; Tue, 25 Oct 2022 06:59:24 -0700 (PDT) From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1666706362; 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=I9KrkHTSRk9elfiy6IejGCtNRlCE++/FB5CiuBByAlk=; b=Tf/9SYQHSN3IMkZcm9kCZ3W33EouF/PiE/b3UwATQokC0EG5MUmZFfaAaIw39OPEAGAF5q iQr76ZtsG8TfY63OCJJ3O9/tzgpnPH07vtmiA6dFcZC+Zyz2G9+V6BNpVSUU13v2T/+fxv 9nM/6qUrpyyQz2Ig9L0SRTlljVnV2GkKK8t+BTNSU/awtJpdbuAC+MIpV7a/G25MbhV/QP IU0hjTK/jGQbmg3rOHBUHtaK6HRgecu0ArBIpH/i01KKv4LXgf1/cyqxu2a4UyXAdPVykw 1ZhmDzeWXqPKo1EArrzyXdnWCBaaBnFQ/8TC5YsmdQYrIIqVEq/L4DeGGba4pg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1666706362; 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=I9KrkHTSRk9elfiy6IejGCtNRlCE++/FB5CiuBByAlk=; b=OOxPYlfB3OREmJmPIE3ZC4Fnc8ctFR4lOH9DY2WH8sgffZSKb7Qg8OSTwLzHciSDREJlBN tiS+6dl2kh8Hd1Bg== To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , John Stultz , Eric Dumazet , Thomas Gleixner , "Rafael J. Wysocki" , linux-pm@vger.kernel.org, Arjan van de Ven , "Paul E. McKenney" , Frederic Weisbecker , Rik van Riel , Anna-Maria Behnsen Subject: [PATCH v3 04/17] timer: Split next timer interrupt logic Date: Tue, 25 Oct 2022 15:58:37 +0200 Message-Id: <20221025135850.51044-5-anna-maria@linutronix.de> In-Reply-To: <20221025135850.51044-1-anna-maria@linutronix.de> References: <20221025135850.51044-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,URIBL_BLOCKED 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?1747668570563585883?= X-GMAIL-MSGID: =?utf-8?q?1747668570563585883?= Logic for getting next timer interrupt (no matter of recalculated or already stored in base->next_expiry) is split into a separate function "next_timer_interrupt()" to make it available for new call sites. No functional change. Signed-off-by: Anna-Maria Behnsen Reviewed-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker --- kernel/time/timer.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 7695c733dfa5..f34bc75ff848 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1681,6 +1681,15 @@ static u64 cmp_next_hrtimer_event(u64 basem, u64 expires) return DIV_ROUND_UP_ULL(nextevt, TICK_NSEC) * TICK_NSEC; } + +static unsigned long next_timer_interrupt(struct timer_base *base) +{ + if (base->next_expiry_recalc) + __next_timer_interrupt(base); + + return base->next_expiry; +} + /** * get_next_timer_interrupt - return the time (clock mono) of the next timer * @basej: base time jiffies @@ -1703,9 +1712,8 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem) return expires; raw_spin_lock(&base->lock); - if (base->next_expiry_recalc) - __next_timer_interrupt(base); - nextevt = base->next_expiry; + + nextevt = next_timer_interrupt(base); /* * We have a fresh next event. Check whether we can forward the