[PATCH v5 16/24] virt/steal_monitor: Define steal_monitor structure
From: Shrikanth Hegde
Date: Thu Jun 25 2026 - 08:50:29 EST
Main structure of steal monitor. It has
- work: deferred periodic work function
- prev_steal, prev_time - To calculate the delta in periodic work.
- interval_ms, high_threshold, low_threshold - debug knobs of
steal_monitor.
sm_core_ctx - instance used by the core code.
Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
---
v4->v5:
- Modified for steal_monitor
drivers/virt/steal_monitor/sm_core.c | 2 ++
drivers/virt/steal_monitor/sm_core.h | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/drivers/virt/steal_monitor/sm_core.c b/drivers/virt/steal_monitor/sm_core.c
index b1865fcdff93..3feb686dd3c4 100644
--- a/drivers/virt/steal_monitor/sm_core.c
+++ b/drivers/virt/steal_monitor/sm_core.c
@@ -14,6 +14,8 @@
#include "sm_core.h"
+struct steal_monitor sm_core_ctx;
+
static int __init steal_monitor_init(void)
{
pr_info("steal_monitor is enabled\n");
diff --git a/drivers/virt/steal_monitor/sm_core.h b/drivers/virt/steal_monitor/sm_core.h
index 684a258526e1..a4e813319680 100644
--- a/drivers/virt/steal_monitor/sm_core.h
+++ b/drivers/virt/steal_monitor/sm_core.h
@@ -8,4 +8,16 @@
#include <linux/kernel.h>
#include <linux/init.h>
+struct steal_monitor {
+ struct delayed_work work;
+ u64 prev_steal;
+ int prev_direction;
+ unsigned int interval_ms;
+ unsigned int high_threshold;
+ unsigned int low_threshold;
+ ktime_t prev_time;
+};
+
+extern struct steal_monitor sm_core_ctx;
+
#endif /* __VIRT_STEAL_CORE_H */
--
2.47.3