lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f63cf28a-9c2c-40d3-846d-2d1a6682473a@intel.com>
Date: Tue, 13 Jan 2026 15:54:41 +0800
From: "Guo, Wangyang" <wangyang.guo@...el.com>
To: K Prateek Nayak <kprateek.nayak@....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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ