Re: [patch 17/38] ext4: Replace get_cycles() usage with ktime_get()

"Arnd Bergmann" <[email protected]> Mon, 13 Apr 2026 16:46:30 +0200
Newsgroups gmane.linux.ports.ppc64.devel,gmane.linux.kernel,gmane.comp.file-systems.ext4,gmane.linux.network,gmane.linux.kernel.wireless.general,gmane.linux.kernel.cryptoapi,gmane.linux.kernel.mm,gmane.linux.hams,gmane.linux.ports.alpha,gmane.linux.ports.arm.kernel,gmane.linux.ports.parisc,gmane.linux.ports.riscv,gmane.linux.ports.sparc
Message-ID <[email protected]>
On Fri, Apr 10, 2026, at 14:19, Thomas Gleixner wrote:
> get_cycles() is not guaranteed to be functional on all systems/platforms
> and the values returned are unitless and not easy to map to something
> useful.
>
> Use ktime_get() instead, which provides nanosecond timestamps and is
> functional everywhere.
>
> This is part of a larger effort to limit get_cycles() usage to low level
> architecture code.
>
> Signed-off-by: Thomas Gleixner <[email protected]>
> Cc: "Theodore Ts'o" <[email protected]>
> Cc: [email protected]

I think this is technically an ABI chance, since the time
difference gets exported through procfs, but the new version
is clearly the right thing to do since it replaces a hardware
specific value with a portable one.

       Arnd