[PATCH v9 1/5] mm/vmstat: Add CPU-specific variable to track a vmstat discrepancy

Marcelo Tosatti posted 5 patches 2 years, 9 months ago
[PATCH v9 1/5] mm/vmstat: Add CPU-specific variable to track a vmstat discrepancy
Posted by Marcelo Tosatti 2 years, 9 months ago
From: Aaron Tomlin <atomlin@redhat.com>

Introduce a CPU-specific variable namely vmstat_dirty to indicate
if a vmstat imbalance is present for a given CPU. Therefore, at
the appropriate time, we can fold all the remaining differentials.
This patch also provides trivial helpers for modification and testing.

Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
---
 mm/vmstat.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Index: linux-2.6/mm/vmstat.c
===================================================================
--- linux-2.6.orig/mm/vmstat.c
+++ linux-2.6/mm/vmstat.c
@@ -194,6 +194,22 @@ void fold_vm_numa_events(void)
 #endif
 
 #ifdef CONFIG_SMP
+static DEFINE_PER_CPU_ALIGNED(bool, vmstat_dirty);
+
+static inline void vmstat_mark_dirty(void)
+{
+	this_cpu_write(vmstat_dirty, true);
+}
+
+static inline void vmstat_clear_dirty(void)
+{
+	this_cpu_write(vmstat_dirty, false);
+}
+
+static inline bool is_vmstat_dirty(void)
+{
+	return this_cpu_read(vmstat_dirty);
+}
 
 int calculate_pressure_threshold(struct zone *zone)
 {
Re: [PATCH v9 1/5] mm/vmstat: Add CPU-specific variable to track a vmstat discrepancy
Posted by Frederic Weisbecker 2 years, 9 months ago
On Tue, Dec 06, 2022 at 01:18:27PM -0300, Marcelo Tosatti wrote:
> From: Aaron Tomlin <atomlin@redhat.com>
> 
> Introduce a CPU-specific variable namely vmstat_dirty to indicate
> if a vmstat imbalance is present for a given CPU. Therefore, at
> the appropriate time, we can fold all the remaining differentials.
> This patch also provides trivial helpers for modification and testing.
> 
> Signed-off-by: Aaron Tomlin <atomlin@redhat.com>

Your SOB is also missing here and on other patches.

Thanks.

> ---
>  mm/vmstat.c |   16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> Index: linux-2.6/mm/vmstat.c
> ===================================================================
> --- linux-2.6.orig/mm/vmstat.c
> +++ linux-2.6/mm/vmstat.c
> @@ -194,6 +194,22 @@ void fold_vm_numa_events(void)
>  #endif
>  
>  #ifdef CONFIG_SMP
> +static DEFINE_PER_CPU_ALIGNED(bool, vmstat_dirty);
> +
> +static inline void vmstat_mark_dirty(void)
> +{
> +	this_cpu_write(vmstat_dirty, true);
> +}
> +
> +static inline void vmstat_clear_dirty(void)
> +{
> +	this_cpu_write(vmstat_dirty, false);
> +}
> +
> +static inline bool is_vmstat_dirty(void)
> +{
> +	return this_cpu_read(vmstat_dirty);
> +}
>  
>  int calculate_pressure_threshold(struct zone *zone)
>  {
> 
>