From patchwork Thu Feb 22 17:12:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 204871 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp82187dyb; Thu, 22 Feb 2024 09:13:08 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCULc2QwY9JS4ZTvET1z1XxSwGMS9cimX3+ZxAwG4Gk15RQyBkLzuCKbT1YYGwbtjdkldpzcTLXYWga7ysG3nmjj2ZFQUQ== X-Google-Smtp-Source: AGHT+IHC2QA7HKO27g0VH+1OlXOo6l/sCNkp2KAKHQAFpmvF7rKBrOStS3K6XjdQvsCdHNAnDJvl X-Received: by 2002:a17:90b:110:b0:299:8dac:e2eb with SMTP id p16-20020a17090b011000b002998dace2ebmr10835075pjz.29.1708621987894; Thu, 22 Feb 2024 09:13:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708621987; cv=pass; d=google.com; s=arc-20160816; b=nusDyWeMw/w3blqRwDCjmf0aB5c6ONz9FZdu6ZBgUBIMOOVU+HcAsh3g8l379gOdlM Ip2D4OTL/CUU+xgtZzsrtMf0tYG2IAgQgMt2HXwbMrnsUmLxuni6aihS6jd/6ui82sXJ oYmmoZ8lnOrIEzum5mzdGO/7FAvq//gBZTuj53X6tpwS+VvGqdsIHl1FZByNbpoI3Oh2 kkD6rGZkuyTSOp9c7aoe9oyBIi0hP5icw4jGCU7Mofli/f7x4pRQMicUPET5rhWTlKDU MYpvdPkCOLAcwpy+wtbULlhuXq3LCgJjrhu0mIR5NXx7P0/+lT/o8h/CHjKfeNAicE6s 14rQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=y0VekA1LeP6+r0oR7f6bRGXegQ8bvVyk9FWZ6lTy+kE=; fh=5HLJN1TJcWBAEXmgE4Q1wVLXykLWOFKyiYUuaJ2RJpM=; b=FkLpfUJIcrZCii1NY4zSs+Qk78U+RcC9dTUN1TLFMOWW+zYTUMp/hB6pxdXhufEJN3 J0U8R0PwXwiyAZyHCDy/eCE19XvMelJz9RLcf4ojirithKMhg8SEV7fpF1fJF9UVW5e/ sff7tbfc6Pndkmuth3eEWinAKIpoxtkWlfpTb7oFK2eBq1Ca4fqk7kXk/fMCSfwZX0V/ lgRMuXLejUJ07L2xeMflCuiDe9AANQLa2MX3iE/e0YuCxFX+MTUei+cl10F7B91NnMwO JNMA2hhHx9VqVJ5Pyx5PcLGsLbspdm1P4Oh/bX/ROxonI2flbbRI1UVUeSNSfd8w5gjF 1jNA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=s4eQYMgX; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-76935-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76935-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id n61-20020a17090a5ac300b002997626b137si3924687pji.61.2024.02.22.09.13.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:13:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76935-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=s4eQYMgX; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-76935-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76935-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7808528B593 for ; Thu, 22 Feb 2024 17:13:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36BDB157E7C; Thu, 22 Feb 2024 17:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="s4eQYMgX"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="99YW06g8" 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 C34101552E7; Thu, 22 Feb 2024 17:12:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708621931; cv=none; b=bZN4VHvlOxf1mfRgtXtbZkISBzoH5RJU1nD6J9UOMu+oOZcQOBQXRiUWod9utcCDoJ1YuSgRceskzZrtawy5Doxq3J4umG7wtmHCi59HyP48qaSemi518MqS9sOrlbUy691hYqid+AS78s0Ydjer4lbaLDivTw+X5Rlo9BSmbyA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708621931; c=relaxed/simple; bh=85Za/XRwJbGoco/mpMKTJgU7f9nR6YT3vmk3FqqR8T8=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=cJEN/HkwXmU3Ar/q1dwxy+eS+XqMLa3mnMxfPyE/P7O8TLye5KZmydZCiqDUG9ZUw81HrWV9N45y5jn9v0gOEAc6KIu7uchaA+6XJMIJQsC+7f9XOQAwngw2MFic3PoUarg+Zgua0kqFTordy23uic9mF1pzVpnY9KigAKgPXxw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=s4eQYMgX; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=99YW06g8; arc=none smtp.client-ip=193.142.43.55 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 Date: Thu, 22 Feb 2024 17:12:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708621928; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y0VekA1LeP6+r0oR7f6bRGXegQ8bvVyk9FWZ6lTy+kE=; b=s4eQYMgX31VL5yJoePmyI6RlW9Xt8KqJVxIw5KqELZHMZVfRYcyPgFpBkctzEYDWlTdi6t 2w/GR2Zl3oz6/GHKwsjod+yHyhtyXk+PiEcqjmhEqVtiVFIFABhsEWkyCJ1DOBGFD3m9// r7/jwzb6aQhoHrviY3rEenBUVvGgkzt02VCv3XEScZm1udsU4jF6+8uy6QWf4EhObcvupK WT7PdZUBeUkYSMinht/aHpw8EMy0QIejDgm9P4CrEtwTAdSmNdvTchunScnX6dlKoieltz Wer3qFchEqEsyEUTAomBGJkDzeHAYpdGXlgswWKefnwj/ZYyJsgCH3TOJdtV7w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708621928; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=y0VekA1LeP6+r0oR7f6bRGXegQ8bvVyk9FWZ6lTy+kE=; b=99YW06g85I69+UY3kh3ztNClNbMZaUU8dBY8QdbaOI1+P2miuw+DDO33u3v4Sp3GlZxk6T 7Zno27Z6R3FNbzCA== From: "tip-bot2 for Richard Cochran (linutronix GmbH)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] tick/sched: Split out jiffies update helper function Cc: "Richard Cochran (linutronix GmbH)" , "Anna-Maria Behnsen" , Thomas Gleixner , Frederic Weisbecker , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240221090548.36600-17-anna-maria@linutronix.de> References: <20240221090548.36600-17-anna-maria@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170862192736.398.7443527640272199216.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791499072031615585 X-GMAIL-MSGID: 1791620009880404395 The following commit has been merged into the timers/core branch of tip: Commit-ID: 4c532939aa2e9345ee346bc69d3d12d56d5aa9aa Gitweb: https://git.kernel.org/tip/4c532939aa2e9345ee346bc69d3d12d56d5aa9aa Author: Richard Cochran (linutronix GmbH) AuthorDate: Wed, 21 Feb 2024 10:05:44 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 22 Feb 2024 17:52:32 +01:00 tick/sched: Split out jiffies update helper function 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 Signed-off-by: Thomas Gleixner Reviewed-by: Frederic Weisbecker Link: https://lore.kernel.org/r/20240221090548.36600-17-anna-maria@linutronix.de --- kernel/time/tick-internal.h | 1 + kernel/time/tick-sched.c | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 8b0c28e..ccf39be 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 f6b6133..417bb7f 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -799,6 +799,24 @@ static inline bool local_timer_softirq_pending(void) return local_softirq_pending() & BIT(TIMER_SOFTIRQ); } +/* + * Read jiffies and the time when jiffies were updated last + */ +u64 get_jiffies_update(unsigned long *basej) +{ + unsigned long basejiff; + unsigned int seq; + u64 basemono; + + do { + seq = read_seqcount_begin(&jiffies_seq); + basemono = last_jiffies_update; + basejiff = jiffies; + } while (read_seqcount_retry(&jiffies_seq, seq)); + *basej = basejiff; + return basemono; +} + /** * tick_nohz_next_event() - return the clock monotonic based next event * @ts: pointer to tick_sched struct @@ -813,14 +831,8 @@ static ktime_t tick_nohz_next_event(struct tick_sched *ts, int cpu) { u64 basemono, next_tick, delta, expires; unsigned long basejiff; - unsigned int seq; - /* 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)); + basemono = get_jiffies_update(&basejiff); ts->last_jiffies = basejiff; ts->timer_expires_base = basemono;