[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e3de7bc0-477b-4f26-b53a-101319a98816@amd.com>
Date: Tue, 13 Jan 2026 09:56:52 +0530
From: K Prateek Nayak <kprateek.nayak@....com>
To: Wangyang Guo <wangyang.guo@...el.com>, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>, Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>, Dietmar Eggemann
<dietmar.eggemann@....com>, Steven Rostedt <rostedt@...dmis.org>, Ben Segall
<bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>, Valentin Schneider
<vschneid@...hat.com>
CC: <linux-kernel@...r.kernel.org>, Shrikanth Hegde <sshegde@...ux.ibm.com>,
Benjamin Lei <benjamin.lei@...el.com>, Tim Chen <tim.c.chen@...ux.intel.com>,
Tianyou Li <tianyou.li@...el.com>
Subject: Re: [PATCH] sched/clock: Avoid false sharing for sched_clock_irqtime
Hello Wangyang,
On 1/13/2026 8:36 AM, Wangyang Guo wrote:
> Read-mostly sched_clock_irqtime may share the same cacheline with
> frequently updated nohz struct. Make it as cache aligned to avoid
> false sharing issue.
nit.
Since you mention this is a "Read-mostly" data ...
[..snip..]
> diff --git a/kernel/sched/cputime.c b/kernel/sched/cputime.c
> index 7097de2c8cda..34d15972f5fb 100644
> --- a/kernel/sched/cputime.c
> +++ b/kernel/sched/cputime.c
> @@ -25,7 +25,7 @@
> */
> DEFINE_PER_CPU(struct irqtime, cpu_irqtime);
>
> -int sched_clock_irqtime;
> +int sched_clock_irqtime __cacheline_aligned;
Have you tried annotating it with "__ro_after_init" or "__read_mostly"?
That should also ensure "sched_clock_irqtime" doesn't have false-sharing
with the nohz struct without using an entire cacheline worth of space.
--
Thanks and Regards,
Prateek
Powered by blists - more mailing lists