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: <d0ac97c1-97ca-4a93-afe7-c1e9dd1ec150@intel.com>
Date: Mon, 26 Jan 2026 10:28:26 +0800
From: "Guo, Wangyang" <wangyang.guo@...el.com>
To: Shrikanth Hegde <sshegde@...ux.ibm.com>
Cc: linux-kernel@...r.kernel.org, Benjamin Lei <benjamin.lei@...el.com>,
 Tim Chen <tim.c.chen@...ux.intel.com>, Tianyou Li <tianyou.li@...el.com>,
 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>
Subject: Re: [PATCH v3] sched/clock: Avoid false sharing for
 sched_clock_irqtime

On 1/17/2026 12:58 AM, Shrikanth Hegde wrote:
> Hi Wangyang.
> 
> On 1/16/26 8:09 AM, Wangyang Guo wrote:
>> Read-mostly sched_clock_irqtime may share the same cacheline with
>> frequently updated nohz struct. Make it as static_key to avoid
>> false sharing issue.
>>
>> Details:
>> We observed ~3% cycles hotspots in irqtime_account_irq when running
>> SPECjbb2015 in a 2-sockets system. Most of cycles spent in reading
>> sched_clock_irqtime, which is a read-mostly var.
>>
>> perf c2c (cachelien view) shows it has false sharing with nohz struct:
>>       Num RmtHitm LclHitm  Offset records             Symbol
>>     6.25%   0.00%   0.00%   0x0       4   [k] _nohz_idle_balance.isra.0
>>    18.75% 100.00%   0.00%   0x8      14   [k] nohz_balance_exit_idle
>>     6.25%   0.00%   0.00%   0x8       8   [k] nohz_balance_enter_idle
>>     6.25%   0.00%   0.00%   0xc       8   [k] sched_balance_newidle
>>     6.25%   0.00%   0.00%  0x10      31   [k] nohz_balancer_kick
>>     6.25%   0.00%   0.00%  0x20      16   [k] sched_balance_newidle
>>    37.50%   0.00%   0.00%  0x38      50   [k] irqtime_account_irq
>>     6.25%   0.00%   0.00%  0x38      47   [k] account_process_tick
>>     6.25%   0.00%   0.00%  0x38      12   [k] account_idle_ticks
>>
>> Offsets:
>> *  0x0 -- nohz.idle_cpu_mask (r)
>> *  0x8 -- nohz.nr_cpus (w)
> 
> This is recently removed.
> 
>> * 0x38 -- sched_clock_irqtime (r), not in nohz, but share cacheline
>>
>> The layout in /proc/kallsyms can also confirm that:
>> ffffffff88600d40 b nohz
>> ffffffff88600d68 B arch_needs_tick_broadcast
>> ffffffff88600d6c b __key.264
>> ffffffff88600d6c b __key.265
>> ffffffff88600d70 b dl_generation
>> ffffffff88600d78 b sched_clock_irqtime
>>
>> With the patch applied, irqtime_account_irq hotspot disappear.
>>
> 
> This changelog likely needs to change with recent removal of nohz.nr_cpus.
> Please re-run it once with latest sched/core.
> (atleast offsets etc)
> 
> The patch has merit on its own since the variable doesn't update often.

Thanks for the reminder, I have add kernel version info in the changelog 
(v4) to avoid the confusing.

BR
Wangyang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ