[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240822070717.12773-1-chenyufan@vivo.com>
Date: Thu, 22 Aug 2024 15:07:17 +0800
From: Chen Yufan <chenyufan@...o.com>
To: John Stultz <jstultz@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Stephen Boyd <sboyd@...nel.org>,
linux-kernel@...r.kernel.org
Cc: opensource.kernel@...o.com,
Chen Yufan <chenyufan@...o.com>
Subject: [PATCH v1] timekeeping: Convert to use jiffies macro
Use time_after macro instead of using
jiffies directly to handle wraparound.
Signed-off-by: Chen Yufan <chenyufan@...o.com>
---
kernel/time/timekeeping.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 5391e4167..6cda65dbe 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -217,7 +217,7 @@ static void timekeeping_check_update(struct timekeeper *tk, u64 offset)
}
if (tk->underflow_seen) {
- if (jiffies - tk->last_warning > WARNING_FREQ) {
+ if (time_after(jiffies, tk->last_warning + WARNING_FREQ)) {
printk_deferred("WARNING: Underflow in clocksource '%s' observed, time update ignored.\n", name);
printk_deferred(" Please report this, consider using a different clocksource, if possible.\n");
printk_deferred(" Your kernel is probably still fine.\n");
@@ -227,7 +227,7 @@ static void timekeeping_check_update(struct timekeeper *tk, u64 offset)
}
if (tk->overflow_seen) {
- if (jiffies - tk->last_warning > WARNING_FREQ) {
+ if (time_after(jiffies, tk->last_warning + WARNING_FREQ)) {
printk_deferred("WARNING: Overflow in clocksource '%s' observed, time update capped.\n", name);
printk_deferred(" Please report this, consider using a different clocksource, if possible.\n");
printk_deferred(" Your kernel is probably still fine.\n");
--
2.39.0
Powered by blists - more mailing lists