mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: Wangyang Guo <wangyang.guo@intel.com>
Cc: linux-kernel@vger.kernel.org,
	Benjamin Lei <benjamin.lei@intel.com>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	Tianyou Li <tianyou.li@intel.com>,
	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>
Subject: Re: [PATCH v3] sched/clock: Avoid false sharing for sched_clock_irqtime
Date: Fri, 16 Jan 2026 22:28:32 +0530	[thread overview]
Message-ID: <7277bf6a-eebf-4b76-801a-8d1bab16d911@linux.ibm.com> (raw)
In-Reply-To: <20260116023945.1849329-1-wangyang.guo@intel.com>

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.

  parent reply	other threads:[~2026-01-16 16:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16  2:39 Wangyang Guo
2026-01-16  9:43 ` K Prateek Nayak
2026-01-16 10:22   ` Vincent Guittot
2026-01-16 14:22     ` K Prateek Nayak
2026-01-16 16:41       ` Vincent Guittot
2026-01-19  4:13         ` K Prateek Nayak
2026-01-22 10:36           ` Vincent Guittot
2026-01-23  4:51             ` K Prateek Nayak
2026-01-23 15:58               ` Vincent Guittot
2026-01-23 16:48                 ` K Prateek Nayak
2026-01-26  2:25                   ` Guo, Wangyang
2026-01-16 16:58 ` Shrikanth Hegde [this message]
2026-01-26  2:28   ` Guo, Wangyang

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=7277bf6a-eebf-4b76-801a-8d1bab16d911@linux.ibm.com \
    --to=sshegde@linux.ibm.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=tianyou.li@intel.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=wangyang.guo@intel.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®