Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp571590rdb; Mon, 15 Jan 2024 06:41:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IExizzxsra8tRgIGi21vAxQ3FnGsmP+bT0v6YF3lcgM8BxcW0dDNCWx6vYByPCxS3q42rV1 X-Received: by 2002:a19:6552:0:b0:50e:e668:767b with SMTP id c18-20020a196552000000b0050ee668767bmr2278061lfj.5.1705329693610; Mon, 15 Jan 2024 06:41:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705329693; cv=none; d=google.com; s=arc-20160816; b=e75eEEACa8n1Ulu8QK9oxwJjni+AL22lASDSlRWNB473t9pJHdDWSF4WiIb4NDG5nb a0bVBZhF9jHwZXSiG1VOu2PbjcGMANSmk2fXtOMK1EBb/pTCsjFY5inIqO5JRy5882oL mk04rOuwgCCwRR2NgQlgiEJTE2tCtjB590VPZkHz/2eJzw1hbmzmXe6cPCwxU1C+Azsg hMcO1WDtYxS83LZL2UT59YJlcsicq2TS8l/FalPmZTghdE9S+BZPWQCNoSv/QYj4ro7f jrDH2zmyVIeMjcvaugXFJ8hsIGaIFwUSXeLzHiHJPupPWNBTTah11tmnQzsTa+vVfLVC aHog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:dkim-signature:dkim-signature:from; bh=FfYsNU3nxkN76DhpfApxecdpLCdc0FbmIjtWoc6sI04=; fh=H6hHKnScvHhKAB7z8Wb75LBNJxB0aNyPhv3ZCgyEYhY=; b=zpCi1+JUOcabKg3PItV+DAfpddjZ+nlowDvEuatofCwSQd4SZYnDLjjHVQ8deC556q Lw94nvqP63273okSyGS3koka+f8yFu1Bljlwr/0cIp5VXH3eRL+mys7NAgfRdJRijVGN 7OQjRnljQpxSHeuge6Q7b0c2ixEWcxGHPmWbEoS4rO/bG7jXha+K8CbhHGSNNwivyslA BanPOwIpGYaC4k2bxGv47FnYMg6oqnY0Hc42jLQVCZzEetaqurrNJ5vaivYDI8x83jtu dUbNlY1+vVHLZ6LwAqkPV1GgO9gdR9YlLs5aB/TBJFd5y8aHrwt/rnp/kdxPnxANP6bG 65Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Y12vRgDO; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-26112-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26112-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id es13-20020a056402380d00b00557766c0f78si4062664edb.77.2024.01.15.06.41.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 06:41:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26112-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Y12vRgDO; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel+bounces-26112-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26112-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 542931F218C9 for ; Mon, 15 Jan 2024 14:41:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 299E319468; Mon, 15 Jan 2024 14:38:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Y12vRgDO"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="YRhjk5FM" 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 CE71118E08 for ; Mon, 15 Jan 2024 14:38:13 +0000 (UTC) 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 From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1705329492; 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=FfYsNU3nxkN76DhpfApxecdpLCdc0FbmIjtWoc6sI04=; b=Y12vRgDO9utSd0YcJu5fn9UXbjopBvL7kF/0XnYRwwON7Bf/G3o/T4W3sD6QcoHlq1AIDs lNwLRS+UBIPbe8NXsen4ktizBy/saBwcZ4SwljENCh+vx/9bucVeQlNuWqytSP/TkZlm8r iPuOqBb9hPwkH3QgqBlYEUhj6jtuPtlLPqRPNObeRhoXY4lMXzD+/V72lcIcHzfQMiCJcQ z1scyh6FAzsxuawiVN+csfo6MNNBJZvd3dM0WG2KjzlsR/Zb6VU07VrMqt+H4omH3hOhlH Wam9gwWACpqT6lZkLnGh6HZSvhN5Or9R57BW6gfIQzomE7vFRjpnbqKo7wGBNQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1705329492; 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=FfYsNU3nxkN76DhpfApxecdpLCdc0FbmIjtWoc6sI04=; b=YRhjk5FMhkO0wLgA/Vbh2OR1jdhNeTFpGp1jFIrxYWwr0WG9QxF6CHHnyEgwptnnUr01IK Pt1zN3hGlWm30bDA== 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" , Srinivas Pandruvada , K Prateek Nayak , "Richard Cochran (linutronix GmbH)" , Anna-Maria Behnsen Subject: [PATCH v10 16/20] tick/sched: Split out jiffies update helper function Date: Mon, 15 Jan 2024 15:37:39 +0100 Message-Id: <20240115143743.27827-17-anna-maria@linutronix.de> In-Reply-To: <20240115143743.27827-1-anna-maria@linutronix.de> References: <20240115143743.27827-1-anna-maria@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: "Richard Cochran (linutronix GmbH)" The logic to get the time of the last jiffies update will be needed by the timer pull model as well. Move the code into a global function in anticipation of the new caller. No functional change. Signed-off-by: Richard Cochran (linutronix GmbH) Signed-off-by: Anna-Maria Behnsen --- kernel/time/tick-internal.h | 1 + kernel/time/tick-sched.c | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 8b0c28edbd09..ccf39befde85 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -157,6 +157,7 @@ static inline void tick_nohz_init(void) { } #ifdef CONFIG_NO_HZ_COMMON extern unsigned long tick_nohz_active; extern void timers_update_nohz(void); +extern u64 get_jiffies_update(unsigned long *basej); # ifdef CONFIG_SMP extern struct static_key_false timers_migration_enabled; extern void fetch_next_timer_interrupt_remote(unsigned long basej, u64 basem, diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 27f1a2ae7f39..a3eb5165d439 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -799,18 +799,30 @@ static inline bool local_timer_softirq_pending(void) return local_softirq_pending() & BIT(TIMER_SOFTIRQ); } -static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu) +/* + * Read jiffies and the time when jiffies were updated last + */ +u64 get_jiffies_update(unsigned long *basej) { - u64 basemono, next_tick, delta, expires; unsigned long basejiff; unsigned int seq; + u64 basemono; - /* Read jiffies and the time when jiffies were updated last */ do { seq = read_seqcount_begin(&jiffies_seq); basemono = last_jiffies_update; basejiff = jiffies; } while (read_seqcount_retry(&jiffies_seq, seq)); + *basej = basejiff; + return basemono; +} + +static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu) +{ + u64 basemono, next_tick, delta, expires; + unsigned long basejiff; + + basemono = get_jiffies_update(&basejiff); ts->last_jiffies = basejiff; ts->timer_expires_base = basemono; -- 2.39.2