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 v6] sched/clock: Avoid false sharing for sched_clock_irqtime
Date: Tue, 27 Jan 2026 15:30:11 +0800 [thread overview]
Message-ID: <215bbfca-8f63-4f86-b992-5802350055a4@intel.com> (raw)
In-Reply-To: <306a53a5-0b99-4e5a-810b-5aa4e86a72d1@amd.com>
On 1/27/2026 2:30 PM, K Prateek Nayak wrote:
> Hello Wangyang,
>
> On 1/27/2026 10:11 AM, Wangyang Guo wrote:
>> --- a/kernel/sched/clock.c
>> +++ b/kernel/sched/clock.c
>> @@ -173,6 +173,7 @@ notrace static void __sched_clock_work(struct work_struct *work)
>> scd->tick_gtod, __gtod_offset,
>> scd->tick_raw, __sched_clock_offset);
>>
>> + disable_sched_clock_irqtime();
>
> We can come here with !irqtime_enabled() but this is a slowpath so I
> don't really mind calling disable_sched_clock_irqtime() unconditionally
> here. Feel free to include:
>
> Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
> Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
>
> Tested with a bunch of fake cases of sched_clock going unstable by
> hacking the kernel and the irqtime was disabled correctly in both cases
> - pre-lateinit and post-lateinit.
I think we can put irqtime_enabled check in disable_sched_lock_irqtime()
which will benefit in both scenario:
void disable_sched_clock_irqtime(void)
{
- sched_clock_irqtime = 0;
+ if (irqtime_enabled())
+ static_branch_disable(&sched_clock_irqtime);
}
v7:
https://lore.kernel.org/all/20260127072509.2627346-1-wangyang.guo@intel.com/
prev parent reply other threads:[~2026-01-27 7:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 4:41 Wangyang Guo
2026-01-27 6:30 ` K Prateek Nayak
2026-01-27 7:30 ` Guo, Wangyang [this message]
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=215bbfca-8f63-4f86-b992-5802350055a4@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®