Re: [PATCH v2 10/11] mm/vmstat: switch vmstat shepherd to flush per-CPU counters remotely
From: Peter Xu
Date: Thu Mar 02 2023 - 16:03:23 EST
On Thu, Feb 09, 2023 at 12:02:00PM -0300, Marcelo Tosatti wrote:
> +#ifdef CONFIG_HAVE_CMPXCHG_LOCAL
> +/* Flush counters remotely if CPU uses cmpxchg to update its per-CPU counters */
> +static void vmstat_shepherd(struct work_struct *w)
> +{
> + int cpu;
> +
> + cpus_read_lock();
> + for_each_online_cpu(cpu) {
> + cpu_vm_stats_fold(cpu);
Nitpick: IIUC this line is the only change with CONFIG_HAVE_CMPXCHG_LOCAL
to replace the queuing. Would it be cleaner to move the ifdef into
vmstat_shepherd, then, and keep the common logic?
> + cond_resched();
> + }
> + cpus_read_unlock();
> +
> + schedule_delayed_work(&shepherd,
> + round_jiffies_relative(sysctl_stat_interval));
> +}
> +#else
> static void vmstat_shepherd(struct work_struct *w)
> {
> int cpu;
> @@ -2026,6 +2043,7 @@ static void vmstat_shepherd(struct work_
> schedule_delayed_work(&shepherd,
> round_jiffies_relative(sysctl_stat_interval));
> }
> +#endif
>
> static void __init start_shepherd_timer(void)
> {
>
>
>
--
Peter Xu