[Devel] [PATCH vz10 07/14] ve: vzstat: guard wait_start access with CONFIG_SCHEDSTATS

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


The stats.wait_start field in struct task_struct is only present when
CONFIG_SCHEDSTATS is enabled. Guard the access in get_task_lat() with
#ifdef CONFIG_SCHEDSTATS and return 0 when scheduling statistics are
unavailable.

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

https://virtuozzo.atlassian.net/browse/VSTOR-134732
Feature: fix kunit
---
 kernel/ve/vzstat.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/ve/vzstat.c b/kernel/ve/vzstat.c
index 46ac756ba21d..418552bb2e2d 100644
--- a/kernel/ve/vzstat.c
+++ b/kernel/ve/vzstat.c
@@ -103,11 +103,13 @@ void kernel_text_csum_check(void)
  */
 static inline u64 get_task_lat(struct task_struct *t, u64 now)
 {
+#ifdef CONFIG_SCHEDSTATS
 	u64 wstamp;
 
 	wstamp = t->stats.wait_start;
 	if (wstamp && now > wstamp && now - wstamp < (1ULL << 63))
 		return now - wstamp;
+#endif
 	return 0;
 }
 
-- 
2.54.0



More information about the Devel mailing list