[Devel] [PATCH vz10 06/14] mm: page_alloc: guard update_maxlat() with CONFIG_VE

Eva Kurchatova eva.kurchatova at virtuozzo.com
Fri Jun 26 01:08:08 MSK 2026


The update_maxlat() function and the KSTAT_ALLOC_MAX_LAT_PERIOD constant
it uses are only meaningful when CONFIG_VE is enabled. Without the
guard, the declaration in kstat.h and definition in page_alloc.c
reference undefined types, causing build failures with CONFIG_VE=n.

Wrap both the declaration and definition with #ifdef CONFIG_VE.

Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>

https://virtuozzo.atlassian.net/browse/VSTOR-134732
Feature: fix kunit
---
 include/linux/kstat.h | 2 ++
 mm/page_alloc.c       | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/include/linux/kstat.h b/include/linux/kstat.h
index 3fbd7a72092f..80f4ed7cbe80 100644
--- a/include/linux/kstat.h
+++ b/include/linux/kstat.h
@@ -58,7 +58,9 @@ struct kstat_lat_pcpu_struct {
 	u64 avg[3];
 };
 
+#ifdef CONFIG_VE
 void update_maxlat(struct kstat_lat_snap_struct *alloc_lat,
 				u64 lat, unsigned long time);
+#endif
 
 #endif
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 53b0b7cda2a8..d73a8bce101f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4837,6 +4837,7 @@ static __always_inline void warn_high_order(int order, gfp_t gfp_mask)
 	}
 }
 
+#ifdef CONFIG_VE
 void update_maxlat(struct kstat_lat_snap_struct *alloc_lat,
 				u64 lat, unsigned long time)
 {
@@ -4870,6 +4871,7 @@ void update_maxlat(struct kstat_lat_snap_struct *alloc_lat,
 		alloc_lat->time[1] = 0;
 	}
 }
+#endif /* CONFIG_VE */
 
 static void __alloc_collect_stats(gfp_t gfp_mask, unsigned int order,
 		struct page *page, u64 time, u64 current_clock)
-- 
2.54.0



More information about the Devel mailing list