Skip to contentSkip to conversation

virt/steal_governor: Remove redundant delay filed

PATCH In review Fushuai Wang 2 participants 3 messages Nov 18 Steal governor driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virt/steal_governor: Remove redundant delay filed

From: Fushuai Wang <[email protected]>

The 'delay' member in struct steal_governor is just a cache for msecs_to_jiffies(interval_ms). The duplicate state is confusing and adds no value. Use msecs_to_jiffies() directly at the schedule site and remove the 'delay' field.

---
 drivers/virt/steal_governor.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/virt/steal_governor.c +2 -4
index 6e31f9923dea..8af6c02c7e77 100644
@@ -38,7 +38,6 @@
 struct steal_governor {
 	ktime_t			time;
 	u64			steal;
-	unsigned long		delay;
 	unsigned int		interval_ms;
 	unsigned int		high_threshold;
 	unsigned int		low_threshold;
@@ -252,7 +251,7 @@ static void steal_governor_loop(struct work_struct *work)
 	}
 
 requeue_work:
-	schedule_delayed_work(&sg_ctx.work, sg_ctx.delay);
+	schedule_delayed_work(&sg_ctx.work, msecs_to_jiffies(sg_ctx.interval_ms));
 }
 
 static int __init steal_governor_init(void)
@@ -270,11 +269,10 @@ static int __init steal_governor_init(void)
 		return -EINVAL;
 	}
 
-	sg_ctx.delay = msecs_to_jiffies(sg_ctx.interval_ms);
 	INIT_DELAYED_WORK(&sg_ctx.work, steal_governor_loop);
 	sg_ctx.steal = get_system_steal_time();
 	sg_ctx.time = ktime_get();
-	schedule_delayed_work(&sg_ctx.work, sg_ctx.delay);
+	schedule_delayed_work(&sg_ctx.work, msecs_to_jiffies(sg_ctx.interval_ms));
 	pr_info("enabled. interval: %ums, high_threshold: %u, low_threshold: %u\n",
 		sg_ctx.interval_ms, sg_ctx.high_threshold, sg_ctx.low_threshold);
 
Signature · 1 line
2.36.1
maintainer
#1 lore raw

Hi.

Quoted 7 lines · Fushuai Wang

From: Fushuai Wang <[email protected]>

The 'delay' member in struct steal_governor is just a cache for msecs_to_jiffies(interval_ms). The duplicate state is confusing and adds no value. Use msecs_to_jiffies() directly at the schedule site and remove the 'delay' field.

I guess you haven't seen the below change which is in tip tree.
https://lore.kernel.org/all/179421651800.2093942.14148413791803216183.tip-bot2@tip-bot2/

With that, we don't need the below change, since there is no more redundant field.

Quoted 39 lines
---
  drivers/virt/steal_governor.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)
drivers/virt/steal_governor.c +2 -4
index 6e31f9923dea..8af6c02c7e77 100644
@@ -38,7 +38,6 @@
  struct steal_governor {
  	ktime_t			time;
  	u64			steal;
-	unsigned long		delay;
  	unsigned int		interval_ms;
  	unsigned int		high_threshold;
  	unsigned int		low_threshold;
@@ -252,7 +251,7 @@ static void steal_governor_loop(struct work_struct *work)
  	}
 
  requeue_work:
-	schedule_delayed_work(&sg_ctx.work, sg_ctx.delay);
+	schedule_delayed_work(&sg_ctx.work, msecs_to_jiffies(sg_ctx.interval_ms));
  }
 
  static int __init steal_governor_init(void)
@@ -270,11 +269,10 @@ static int __init steal_governor_init(void)
  		return -EINVAL;
  	}
 
-	sg_ctx.delay = msecs_to_jiffies(sg_ctx.interval_ms);
  	INIT_DELAYED_WORK(&sg_ctx.work, steal_governor_loop);
  	sg_ctx.steal = get_system_steal_time();
  	sg_ctx.time = ktime_get();
-	schedule_delayed_work(&sg_ctx.work, sg_ctx.delay);
+	schedule_delayed_work(&sg_ctx.work, msecs_to_jiffies(sg_ctx.interval_ms));
  	pr_info("enabled. interval: %ums, high_threshold: %u, low_threshold: %u\n",
  		sg_ctx.interval_ms, sg_ctx.high_threshold, sg_ctx.low_threshold);
 
#2 lore raw

2026年11月18日 17:04, "Shrikanth Hegde" <[email protected] mailto:[email protected]?to=%22Shrikanth%20Hegde%22%20%3Csshegde%40linux.ibm.com%3E > 写到:

Quoted 12 lines

Hi.

Quoted 7 lines · Fushuai Wang

From: Fushuai Wang <[email protected]>
The 'delay' member in struct steal_governor is just a cache for msecs_to_jiffies(interval_ms). The duplicate state is confusing and adds no value. Use msecs_to_jiffies() directly at the schedule site and remove the 'delay' field.

Quoted 5 lines

I guess you haven't seen the below change which is in tip tree.
https://lore.kernel.org/all/179421651800.2093942.14148413791803216183.tip-bot2@tip-bot2/

With that, we don't need the below change, since there is no more redundant field.

Sorry I missed this, please ignore this mail.

Regards,
Fushuai.