From patchwork Wed May 24 07:06:13 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: 98345 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2653788vqo; Wed, 24 May 2023 00:16:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4JHLo8S5Qlh9n1DK5xXquwqyg3xqTbqpSrDfrLoQCXCE05xJgqiGNIV3WzClUWMbr93KbG X-Received: by 2002:a17:90b:1644:b0:255:e753:dcaf with SMTP id il4-20020a17090b164400b00255e753dcafmr5393pjb.16.1684912612917; Wed, 24 May 2023 00:16:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684912612; cv=none; d=google.com; s=arc-20160816; b=aQDn974hNsD3moGsL0Uz0QUcwgGTgMdabtrFuveSE37MNGUjTUChHBw7QV7kS/3lmu R91yy8rErU+DUJ7zTmogrpbb4DGRXKdIM1YXhARSqW+/oUPsqJIMMCybttwy8QTzOjHW gO6aoxHsxuEX6qLe7UuYe1nCDXeyTtYoSkdnzePhklbmhAYKgIdy1OEVWl4pUCk8dg4y ZcFEbEA0qeDvbKsuLsAmNyg44TjWrYijRYTJeW6UdkpxTyqs846C7cHvuDpoGauCOgpk dxT4WJxvMiHCnbekSQLMD4rfqyQDkS9Iea2nb/0EMnngYYMVy1+8tqhMNgH1T4b5JSDK NSow== 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=HxmCND6qgUOL8dSwqTz+jvdhC0vJDN9Q/b7YApMcna0=; b=b1Yw8h/XsuAtPNU2nSHSfXEvl+gmksfDfGjd4qb0Y5ni8pSUwsINHkvh5U67PBcG1a lJPkRkhApnJ0si/rqVwE/65uRY+y8Vleib6qDJncvrg+gBFTtaQbHqc+amyl1pNKyO5r K7P71gGTuhdsjpbHPSUjyQ1vmkI2vxMioYiF78bRoKOOVPknergKZBi15XUEJZg9SSww 4hgXOC39+YLCdRCNOjNv2e2MGVvJeQDz0ZXbZw1g0jWiV5jcRNU1otDEYAo/rjjWSyAb IIh0glVTkSFKPphGerv758Ate0/O3R+pObrzNMTYKLGD1L/Kq8is1lD39QjaEsUny5m3 Jgsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=UqSy0m3N; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=aXODCXcf; 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 m13-20020a17090ade0d00b0024e3527e8f1si834067pjv.60.2023.05.24.00.16.38; Wed, 24 May 2023 00:16:52 -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=UqSy0m3N; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=aXODCXcf; 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 S239887AbjEXHHZ (ORCPT + 99 others); Wed, 24 May 2023 03:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239796AbjEXHHC (ORCPT ); Wed, 24 May 2023 03:07:02 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39E84B6 for ; Wed, 24 May 2023 00:07:00 -0700 (PDT) From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1684912018; 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=HxmCND6qgUOL8dSwqTz+jvdhC0vJDN9Q/b7YApMcna0=; b=UqSy0m3N8Wqw9BX3M7onpKiverK90EhM6obouvh6WE77o1fYsssDtYGcukRNa2uQOs6y3v lMXPYkGzRUdutJjZY2p0zykh7P3Lef0opyP21vN9qbaEJFxGh/nWNZoVl2iepcrzjmOkuN eocA83ihRgF8Sp5hgQRSQKMMTe5PTJhxAvs3Bp3zh0ah9Ms9multYarnqFd2Y2yqu8jd2z zUurqJnHxKHW8o8KVVc505hfygDLPmOvcLrKpzUaCmIzCEYcUORyUR1nYviCLcJUCEVYF1 F4SVLVmjFnNNPKj1crknpWxcSoUhOWOAH0RFfu1UE48J9jZgcU/INczn9zjH9Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1684912018; 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=HxmCND6qgUOL8dSwqTz+jvdhC0vJDN9Q/b7YApMcna0=; b=aXODCXcf92QefXn6aVZ7336BGvru5y8XgcoqyIDc1SfIGCvQxyXffdu+85D9MO1L2K4ODv I9FQh/rssYnDUfCA== 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 05/21] timer: Split next timer interrupt logic Date: Wed, 24 May 2023 09:06:13 +0200 Message-Id: <20230524070629.6377-6-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?1766758928412495968?= X-GMAIL-MSGID: =?utf-8?q?1766758928412495968?= 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 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 59f2e15733ab..1a61977f9efa 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -1908,6 +1908,14 @@ 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_expiry_recalc(base); + + return base->next_expiry; +} + /** * get_next_timer_interrupt - return the time (clock mono) of the next timer * @basej: base time jiffies @@ -1934,9 +1942,8 @@ u64 get_next_timer_interrupt(unsigned long basej, u64 basem) return expires; raw_spin_lock(&base->lock); - if (base->next_expiry_recalc) - next_expiry_recalc(base); - nextevt = base->next_expiry; + + nextevt = next_timer_interrupt(base); /* * We have a fresh next event. Check whether we can forward the