Re: [PATCH v13 2/6] mm/vmstat: Use vmstat_dirty to track CPU-specific vmstat discrepancies

From: Christoph Lameter
Date: Tue Jan 10 2023 - 07:11:55 EST


On Thu, 5 Jan 2023, Marcelo Tosatti wrote:

> --- linux-2.6.orig/mm/vmstat.c
> +++ linux-2.6/mm/vmstat.c
> @@ -381,6 +381,7 @@ void __mod_zone_page_state(struct zone *
> x = 0;
> }
> __this_cpu_write(*p, x);
> + vmstat_mark_dirty();

__vmstat_mark_dirty()? See earlier patch

>
> preempt_enable_nested();
> }
> @@ -417,6 +418,7 @@ void __mod_node_page_state(struct pglist
> x = 0;
> }
> __this_cpu_write(*p, x);
> + vmstat_mark_dirty();

Ditto.

>
> preempt_enable_nested();
> }
> @@ -577,6 +579,9 @@ static inline void mod_zone_state(struct
> s8 __percpu *p = pcp->vm_stat_diff + item;
> long o, n, t, z;
>
> + /* cmpxchg and vmstat_mark_dirty should happen on the same CPU */
> + preempt_disable();

If you are disabling preemption then why do we still need cmpxchg?
Same again below.