mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] RAS/CEC: Fix decay work delay calculation
@ 2026-11-08  9:52 Jiajun Wang
  0 siblings, 0 replies; only message in thread
From: Jiajun Wang @ 2026-11-08  9:52 UTC (permalink / raw)
  To: tony.luck, bp; +Cc: xiyou.wangcong, linux-edac, linux-kernel

The conversion from a timer to delayed work left two issues in the
decay work scheduling.

The initial delay is passed to schedule_delayed_work() in seconds,
although the function expects jiffies. This schedules the first decay
after 86400 jiffies rather than 24 hours, or approximately 86 seconds
with CONFIG_HZ=1000. Use secs_to_jiffies() to convert the delay.

When rearming the work, cec_mod_work() passes the relative delay to
round_jiffies(), which expects an absolute expiration time. Use
round_jiffies_relative() to round the delay instead.

Fixes: 0ade0b6240c4 ("RAS/CEC: Convert the timer callback to a workqueue")

Signed-off-by: Jiajun Wang <ryan1202@foxmail.com>
---
Build-tested on x86_64 with CONFIG_RAS_CEC=y.
Not runtime-tested.

 drivers/ras/cec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index 15f7f043c8efd..3c61c2aa78f2e 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -166,7 +166,7 @@ static void cec_mod_work(unsigned long interval)
 	unsigned long iv;
 
 	iv = interval * HZ;
-	mod_delayed_work(system_percpu_wq, &cec_work, round_jiffies(iv));
+	mod_delayed_work(system_percpu_wq, &cec_work, round_jiffies_relative(iv));
 }
 
 static void cec_work_fn(struct work_struct *work)
@@ -582,7 +582,7 @@ static int __init cec_init(void)
 	}
 
 	INIT_DELAYED_WORK(&cec_work, cec_work_fn);
-	schedule_delayed_work(&cec_work, CEC_DECAY_DEFAULT_INTERVAL);
+	schedule_delayed_work(&cec_work, secs_to_jiffies(CEC_DECAY_DEFAULT_INTERVAL));
 
 	mce_register_decode_chain(&cec_nb);
 
-- 
2.56.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-08  9:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08  9:52 [PATCH] RAS/CEC: Fix decay work delay calculation Jiajun Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®