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 <[email protected]>

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

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to