From nobody Mon Jun 8 05:26:06 2026 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 3E97131326C; Tue, 2 Jun 2026 19:30:25 +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=1780428627; cv=none; b=nc++DeyKrzGRguy4OmUtXAHYeO+u7cwwTB42EZO6YSJbLu9yZnWXfER5e6hNWZwLMDFWyiLFri/c8rKQjuTA3aWzDXP/eDRyHUfp2kLqU6U00NEuQBPnPJLMXUEa2TpWRDLvD5qKmWmsLXIGwseXlt5rihhnLAWnPm9HEjjxB+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780428627; c=relaxed/simple; bh=goh/cMfm8JDkUUCxbqHNlaXkswIt34I7A8Bd1D+ZVyA=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=Fw48fHYo3OOG9JeyQHNkmijTqIsLBiFdUN+50RHR56qaGrJTwHNiu/rc5nfZRbPaNh6dVKmKFqxmdQbzGTU99Zd/snnMK0rAOmh3nJScVdUkKiGYrdUEpMynC3oIlXzNgms8BLfE3nxo7lkBmRLiZ/DWw9DRkUwrt8M5IhrPfOc= 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=Qnp6K+mB; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=fpWRFhfs; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Qnp6K+mB"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="fpWRFhfs" Date: Tue, 02 Jun 2026 19:30:21 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1780428622; 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=pXYsBawU+7ip3FTxmlul8VZiGMbxlQaU3spQ+y3VO20=; b=Qnp6K+mBj2kjpqSI4nhnukW6LU5H5su01YHlgYUDypRwbOPBWCZIZiomuzZUOKtfj9UhBV vv+iXZxQ3g121Vs8je6XtaKj+hU0tiAgh+nfaYgS7/mJJWvp196YwNdVGRExU/BuIE5lqL Xu6pyrJwgIN91Su23NT1IVl2pHyfXGtyGckNii2F2ifP2jS0GUpED2rIvlNAIMroBlAQ1e fukbjZZ7zdnokqu53GKgMeuUqO1t7OuNI1kBawBFNag3ZE80KfG8eajRrdiij7nFbOeV5F HyI1rwxw4ATrzWX/YlnxTbxYlhOR0ZpsKfGj2NH3VJlVQp2e8yb9pVp5njoFzA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1780428622; 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=pXYsBawU+7ip3FTxmlul8VZiGMbxlQaU3spQ+y3VO20=; b=fpWRFhfsly73mBN1sd3Cs9y/Ff6M5pL/+IS+Ai6yAWnwL4W27kZ2c3PhqxLt5kluHNvULW 6E1kk/riuGF/YQBQ== From: "tip-bot2 for Frederic Weisbecker" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/nohz] sched/cputime: Remove superfluous and error prone kcpustat_field() parameter Cc: Frederic Weisbecker , Thomas Gleixner , Shrikanth Hegde , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260508131647.43868-4-frederic@kernel.org> References: <20260508131647.43868-4-frederic@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178042862108.710.11940523387117850007.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/nohz branch of tip: Commit-ID: 080b5c6d95034e46f5ed1abe98c06218a1386aef Gitweb: https://git.kernel.org/tip/080b5c6d95034e46f5ed1abe98c06218a= 1386aef Author: Frederic Weisbecker AuthorDate: Fri, 08 May 2026 15:16:35 +02:00 Committer: Thomas Gleixner CommitterDate: Tue, 02 Jun 2026 21:27:25 +02:00 sched/cputime: Remove superfluous and error prone kcpustat_field() parameter The first parameter to kcpustat_field() is a pointer to the cpu kcpustat to be fetched from. This parameter is error prone because a copy to a kcpustat could be passed by accident instead of the original one. Also the kcpustat structure can already be retrieved with the help of the mandatory CPU argument. Remove the needless parameter. Signed-off-by: Frederic Weisbecker Signed-off-by: Thomas Gleixner Tested-by: Shrikanth Hegde Reviewed-by: Shrikanth Hegde Link: https://patch.msgid.link/20260508131647.43868-4-frederic@kernel.org --- drivers/cpufreq/cpufreq_governor.c | 6 +++--- drivers/macintosh/rack-meter.c | 2 +- include/linux/kernel_stat.h | 8 +++----- kernel/rcu/tree.c | 9 +++------ kernel/rcu/tree_stall.h | 7 +++---- kernel/sched/cputime.c | 5 ++--- 6 files changed, 15 insertions(+), 22 deletions(-) diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_g= overnor.c index 86f35e4..3c4a1f9 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -105,7 +105,7 @@ void gov_update_cpu_data(struct dbs_data *dbs_data) j_cdbs->prev_cpu_idle =3D get_cpu_idle_time(j, &j_cdbs->prev_update_tim= e, dbs_data->io_is_busy); if (dbs_data->ignore_nice_load) - j_cdbs->prev_cpu_nice =3D kcpustat_field(&kcpustat_cpu(j), CPUTIME_NIC= E, j); + j_cdbs->prev_cpu_nice =3D kcpustat_field(CPUTIME_NICE, j); } } } @@ -165,7 +165,7 @@ unsigned int dbs_update(struct cpufreq_policy *policy) j_cdbs->prev_cpu_idle =3D cur_idle_time; =20 if (ignore_nice) { - u64 cur_nice =3D kcpustat_field(&kcpustat_cpu(j), CPUTIME_NICE, j); + u64 cur_nice =3D kcpustat_field(CPUTIME_NICE, j); =20 idle_time +=3D div_u64(cur_nice - j_cdbs->prev_cpu_nice, NSEC_PER_USEC); j_cdbs->prev_cpu_nice =3D cur_nice; @@ -539,7 +539,7 @@ int cpufreq_dbs_governor_start(struct cpufreq_policy *p= olicy) j_cdbs->prev_load =3D 0; =20 if (ignore_nice) - j_cdbs->prev_cpu_nice =3D kcpustat_field(&kcpustat_cpu(j), CPUTIME_NICE= , j); + j_cdbs->prev_cpu_nice =3D kcpustat_field(CPUTIME_NICE, j); } =20 gov->start(policy); diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c index 8a1e2c0..26cb931 100644 --- a/drivers/macintosh/rack-meter.c +++ b/drivers/macintosh/rack-meter.c @@ -87,7 +87,7 @@ static inline u64 get_cpu_idle_time(unsigned int cpu) kcpustat->cpustat[CPUTIME_IOWAIT]; =20 if (rackmeter_ignore_nice) - retval +=3D kcpustat_field(kcpustat, CPUTIME_NICE, cpu); + retval +=3D kcpustat_field(CPUTIME_NICE, cpu); =20 return retval; } diff --git a/include/linux/kernel_stat.h b/include/linux/kernel_stat.h index b97ce2d..dd020ec 100644 --- a/include/linux/kernel_stat.h +++ b/include/linux/kernel_stat.h @@ -100,14 +100,12 @@ static inline unsigned long kstat_cpu_irqs_sum(unsign= ed int cpu) } =20 #ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN -extern u64 kcpustat_field(struct kernel_cpustat *kcpustat, - enum cpu_usage_stat usage, int cpu); +extern u64 kcpustat_field(enum cpu_usage_stat usage, int cpu); extern void kcpustat_cpu_fetch(struct kernel_cpustat *dst, int cpu); #else -static inline u64 kcpustat_field(struct kernel_cpustat *kcpustat, - enum cpu_usage_stat usage, int cpu) +static inline u64 kcpustat_field(enum cpu_usage_stat usage, int cpu) { - return kcpustat->cpustat[usage]; + return kcpustat_cpu(cpu).cpustat[usage]; } =20 static inline void kcpustat_cpu_fetch(struct kernel_cpustat *dst, int cpu) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 55df6d3..3cbf79b 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -969,14 +969,11 @@ static int rcu_watching_snap_recheck(struct rcu_data = *rdp) if (rcu_cpu_stall_cputime && rdp->snap_record.gp_seq !=3D rdp->gp_seq) { int cpu =3D rdp->cpu; struct rcu_snap_record *rsrp; - struct kernel_cpustat *kcsp; - - kcsp =3D &kcpustat_cpu(cpu); =20 rsrp =3D &rdp->snap_record; - rsrp->cputime_irq =3D kcpustat_field(kcsp, CPUTIME_IRQ, cpu); - rsrp->cputime_softirq =3D kcpustat_field(kcsp, CPUTIME_SOFTIRQ, cpu); - rsrp->cputime_system =3D kcpustat_field(kcsp, CPUTIME_SYSTEM, cpu); + rsrp->cputime_irq =3D kcpustat_field(CPUTIME_IRQ, cpu); + rsrp->cputime_softirq =3D kcpustat_field(CPUTIME_SOFTIRQ, cpu); + rsrp->cputime_system =3D kcpustat_field(CPUTIME_SYSTEM, cpu); rsrp->nr_hardirqs =3D kstat_cpu_irqs_sum(cpu) + arch_irq_stat_cpu(cpu); rsrp->nr_softirqs =3D kstat_cpu_softirqs_sum(cpu); rsrp->nr_csw =3D nr_context_switches_cpu(cpu); diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h index b67532c..cf7ae51 100644 --- a/kernel/rcu/tree_stall.h +++ b/kernel/rcu/tree_stall.h @@ -479,7 +479,6 @@ static void print_cpu_stat_info(int cpu) { struct rcu_snap_record rsr, *rsrp; struct rcu_data *rdp =3D per_cpu_ptr(&rcu_data, cpu); - struct kernel_cpustat *kcsp =3D &kcpustat_cpu(cpu); =20 if (!rcu_cpu_stall_cputime) return; @@ -488,9 +487,9 @@ static void print_cpu_stat_info(int cpu) if (rsrp->gp_seq !=3D rdp->gp_seq) return; =20 - rsr.cputime_irq =3D kcpustat_field(kcsp, CPUTIME_IRQ, cpu); - rsr.cputime_softirq =3D kcpustat_field(kcsp, CPUTIME_SOFTIRQ, cpu); - rsr.cputime_system =3D kcpustat_field(kcsp, CPUTIME_SYSTEM, cpu); + rsr.cputime_irq =3D kcpustat_field(CPUTIME_IRQ, cpu); + rsr.cputime_softirq =3D kcpustat_field(CPUTIME_SOFTIRQ, cpu); + rsr.cputime_system =3D kcpustat_field(CPUTIME_SYSTEM, cpu); =20 pr_err("\t hardirqs softirqs csw/system\n"); pr_err("\t number: %8lld %10d %12lld\n", diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c index fbf31db..caaaf0a 100644 --- a/kernel/sched/cputime.c +++ b/kernel/sched/cputime.c @@ -975,10 +975,9 @@ static int kcpustat_field_vtime(u64 *cpustat, return 0; } =20 -u64 kcpustat_field(struct kernel_cpustat *kcpustat, - enum cpu_usage_stat usage, int cpu) +u64 kcpustat_field(enum cpu_usage_stat usage, int cpu) { - u64 *cpustat =3D kcpustat->cpustat; + u64 *cpustat =3D kcpustat_cpu(cpu).cpustat; u64 val =3D cpustat[usage]; struct rq *rq; int err;