* [PATCH v2] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro
@ 2024-08-22 8:24 Chen Yufan
2024-08-25 11:23 ` Thomas Gleixner
0 siblings, 1 reply; 2+ messages in thread
From: Chen Yufan @ 2024-08-22 8:24 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Chen Yufan, Stephen Rothwell, linux-kernel
Cc: opensource.kernel
Use time_after macro instead of using
jiffies directly to handle wraparound.
Signed-off-by: Chen Yufan <chenyufan@vivo.com>
The modifications made compared to the previous version are as follows:
1. Remove extra '+' in the header.
---
arch/x86/kernel/cpu/aperfmperf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/aperfmperf.c b/arch/x86/kernel/cpu/aperfmperf.c
index 0b69bfbf3..5fe0a7576 100644
--- a/arch/x86/kernel/cpu/aperfmperf.c
+++ b/arch/x86/kernel/cpu/aperfmperf.c
@@ -16,6 +16,7 @@
#include <linux/sched/topology.h>
#include <linux/smp.h>
#include <linux/syscore_ops.h>
+#include <linux/jiffies.h>
#include <asm/cpu.h>
#include <asm/cpu_device_id.h>
@@ -434,7 +435,7 @@ unsigned int arch_freq_get_on_cpu(int cpu)
* Bail on invalid count and when the last update was too long ago,
* which covers idle and NOHZ full CPUs.
*/
- if (!mcnt || (jiffies - last) > MAX_SAMPLE_AGE)
+ if (!mcnt || time_after(jiffies, last + MAX_SAMPLE_AGE))
goto fallback;
return div64_u64((cpu_khz * acnt), mcnt);
--
2.39.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro
2024-08-22 8:24 [PATCH v2] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro Chen Yufan
@ 2024-08-25 11:23 ` Thomas Gleixner
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2024-08-25 11:23 UTC (permalink / raw)
To: Chen Yufan, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Chen Yufan, Stephen Rothwell, linux-kernel
Cc: opensource.kernel
On Thu, Aug 22 2024 at 16:24, Chen Yufan wrote:
> Use time_after macro instead of using
> jiffies directly to handle wraparound.
>
> Signed-off-by: Chen Yufan <chenyufan@vivo.com>
>
> The modifications made compared to the previous version are as follows:
Please put such version information below the --- separator so tools can
strip it off when applying the patch, which avoids editiong
> 1. Remove extra '+' in the header.
The subject line still has a incorrect subsystem prefix:
https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#patch-subject
Also 'use jiffies macro' is not really informative. Something like
"Use time_after() for jiffies comparison"
makes it entirely clear what this is about.
> Use time_after macro instead of using
> jiffies directly to handle wraparound.
Also here instead of 'time_after macro' please use simply
'time_after()'. It's uninteresting whether this is a macro or not.
Thanks,
tglx
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-25 11:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22 8:24 [PATCH v2] X86 architecture (32-bit and 64-bit): Convert to use jiffies macro Chen Yufan
2024-08-25 11:23 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox