[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZrqxqCVbw18AP5Ou@chenyu5-mobl2>
Date: Tue, 13 Aug 2024 09:27:31 +0800
From: Chen Yu <yu.c.chen@...el.com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>
CC: x86 Maintainers <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>, Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>, Srinivas Pandruvada
<srinivas.pandruvada@...ux.intel.com>, "Rafael J. Wysocki"
<rafael@...nel.org>, Dietmar Eggemann <dietmar.eggemann@....com>, "Ricardo
Neri" <ricardo.neri@...el.com>, Tim Chen <tim.c.chen@...el.com>
Subject: Re: [PATCH v2 2/3] x86/sched: Add basic support for CPU capacity
scaling
Hi Rafael,
On 2024-08-12 at 14:42:26 +0200, Rafael J. Wysocki wrote:
> +void arch_set_cpu_capacity(int cpu, unsigned long cap, unsigned long base_cap,
> + unsigned long max_freq, unsigned long base_freq)
> +{
> + if (static_branch_likely(&arch_hybrid_cap_scale_key)) {
> + WRITE_ONCE(per_cpu_ptr(arch_cpu_scale, cpu)->capacity,
> + div_u64(cap << SCHED_CAPACITY_SHIFT, base_cap));
> + WRITE_ONCE(per_cpu_ptr(arch_cpu_scale, cpu)->freq_ratio,
> + div_u64(max_freq << SCHED_CAPACITY_SHIFT, base_freq));
>
Would the capacity update be frequently invoked? Just wonder if we could
first READ_ONCE() to check if the value is already the value we want to
change to, to avoid one write and less cache snoop overhead (in case other
CPU reads this CPU's capacity)
thanks,
Chenyu
Powered by blists - more mailing lists