From: "Guo, Wangyang" <wangyang.guo@intel.com>
To: K Prateek Nayak <kprateek.nayak@amd.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Shrikanth Hegde <sshegde@linux.ibm.com>,
Benjamin Lei <benjamin.lei@intel.com>,
Tim Chen <tim.c.chen@linux.intel.com>,
Tianyou Li <tianyou.li@intel.com>
Subject: Re: [PATCH] sched/clock: Avoid false sharing for sched_clock_irqtime
Date: Tue, 13 Jan 2026 15:54:41 +0800 [thread overview]
Message-ID: <f63cf28a-9c2c-40d3-846d-2d1a6682473a@intel.com> (raw)
In-Reply-To: <e3de7bc0-477b-4f26-b53a-101319a98816@amd.com>
On 1/13/2026 12:26 PM, K Prateek Nayak wrote:
> 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.
__read_mostly works and avoids wasting spaces. It's better than
__cacheline_aligned, patch v2 is sent out as:
https://lore.kernel.org/all/20260113074807.3404180-1-wangyang.guo@intel.com/
BR
Wangyang
next prev parent reply other threads:[~2026-01-13 7:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 3:06 Wangyang Guo
2026-01-13 4:26 ` K Prateek Nayak
2026-01-13 7:54 ` Guo, Wangyang [this message]
2026-01-13 4:48 ` Shrikanth Hegde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f63cf28a-9c2c-40d3-846d-2d1a6682473a@intel.com \
--to=wangyang.guo@intel.com \
--cc=benjamin.lei@intel.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sshegde@linux.ibm.com \
--cc=tianyou.li@intel.com \
--cc=tim.c.chen@linux.intel.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®