Re: [PATCH v9 10/11] virt/steal_governor: Implement steal_governor policy loop
Mete Durlu <[email protected]> Mon, 10 Aug 2026 14:12:07 +0200
| Newsgroups | dev.linux.lists.virtualization,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 27/07/2026 16:42, Shrikanth Hegde wrote:
> Hi Yury,
>
> On 7/25/26 2:35 AM, Yury Norov wrote:
>
>>
>> In v8 I pointed to the identical function in s390 code, and you agreed
>> to unify them, but that didn't happen. Please do that in the next
>> version.
>>
>
> This is diff i have now. I assume this is what you had suggested.
> Let me know if it differs.
>
The chunk below for s390 looks correct to me. I don't see any
difference functionality wise.
>
> diff --git a/arch/s390/kernel/hiperdispatch.c b/arch/s390/kernel/
> hiperdispatch.c
> index 217206522266..0c658f229b17 100644
> --- a/arch/s390/kernel/hiperdispatch.c
> +++ b/arch/s390/kernel/hiperdispatch.c
> @@ -210,13 +210,10 @@ static unsigned long
> hd_calculate_steal_percentage(void)
> int cpus, cpu;
> ktime_t now;
>
> - cpus = 0;
> - steal = 0;
> percentage = 0;
> - for_each_cpu(cpu, &hd_vmvl_cpumask) {
> - steal += kcpustat_cpu(cpu).cpustat[CPUTIME_STEAL];
> - cpus++;
> - }
> + steal = kcpustat_field_total(CPUTIME_STEAL, &hd_vmvl_cpumask);
> + cpus = cpumask_weight(&hd_vmvl_cpumask);
> +
[..snip..]
> --- a/include/linux/kernel_stat.h
> +++ b/include/linux/kernel_stat.h
> @@ -196,6 +196,17 @@ static inline void kcpustat_cpu_fetch(struct
> kernel_cpustat *dst, int cpu)
> }
> #endif /* !CONFIG_VIRT_CPU_ACCOUNTING_GEN */
>
> +static inline u64 kcpustat_field_total(enum cpu_usage_stat usage, const
> struct cpumask *cpus)
> +{
> + u64 total = 0;
> + int cpu;
> +
> + for_each_cpu(cpu, cpus)
> + total += kcpustat_field(usage, cpu);
> +
> + return total;
> +}
> +