[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <215bbfca-8f63-4f86-b992-5802350055a4@intel.com>
Date: Tue, 27 Jan 2026 15:30:11 +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 v6] sched/clock: Avoid false sharing for
sched_clock_irqtime
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@....com>
> Tested-by: K Prateek Nayak <kprateek.nayak@....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/
Powered by blists - more mailing lists