From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CA3A3BE65E; Fri, 10 Apr 2026 12:19:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775823595; cv=none; b=rBi0/ZK3F0bl+yH1eAL6M8C88TNWsdy8XkHdOHzChHkqsyoJSTi+PixSrDpl/QFvfMrxSg4K60Sxq8yGdJm9DV27NT2VMxrCJlZ1qpmfjOoQVDlTT6MBDS/vqIToxuxPJDWw1i67rdcn5qD/ZOxUeahPnqxCwC/yNcD8x3oA/oo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775823595; c=relaxed/simple; bh=QF8xu2w1ekYQn9h8hXu1i+73iAYxDniq8hK08qkXVok=; h=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=H5qg6XHWjf+fn2L34l8+P3Qu0WIK1gUSW9Jwt3xg4tAKJTKCSqEzpkL7/NflayGEEwhEYujzkVKYQgjeXaQwE6JvC3AMwHYCxULov0SXihTr55OtVZ6fgVusQhw4Zl2WOSY7zHU4uLr7t3FCTM2yqeookhtAVFXFEgmYW/wq1pQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jdPhw8GN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jdPhw8GN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5B407C2BC87; Fri, 10 Apr 2026 12:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775823595; bh=QF8xu2w1ekYQn9h8hXu1i+73iAYxDniq8hK08qkXVok=; h=Date:From:To:Cc:Subject:References:From; b=jdPhw8GNcCbidbYQHfvNnynlBMQ6C8yak4JEVkjtLiGZL97Y3Kg6hDMEq3+pAZn9l eebAKa8zdYjNIUhQRVD9BnFcdpgh+r9+oY8nCOOBP3TXDWg59J0yEe49bjDh/j5GY1 J/+Mrsj5Z9JlM/AmirqGD8HvbUDB7O2+WSvwYb2Dt2w8mdLS3mlRSvEUCA//cm+I50 T3lnhTwlF7Ll8vkIeV4joWfasbaLJDpe8kQqwYnenbDJtbX6i3a/y8coaGgKPKMk+y /Al4CmKTrbd6SuhGXm70yx904ODj2E0CWQ5/8mFozaTW1DKtHUVqiCNDO1sI7Gfirg PX6BMdDjfEFyw== Date: Fri, 10 Apr 2026 14:19:52 +0200 Message-ID: <20260410120318.727211419@kernel.org> User-Agent: quilt/0.68 From: Thomas Gleixner To: LKML Cc: "Theodore Tso" , linux-ext4@vger.kernel.org, Arnd Bergmann , x86@kernel.org, Lu Baolu , iommu@lists.linux.dev, Michael Grzeschik , netdev@vger.kernel.org, linux-wireless@vger.kernel.org, Herbert Xu , linux-crypto@vger.kernel.org, Vlastimil Babka , linux-mm@kvack.org, David Woodhouse , Bernie Thompson , linux-fbdev@vger.kernel.org, Andrew Morton , Uladzislau Rezki , Marco Elver , Dmitry Vyukov , kasan-dev@googlegroups.com, Andrey Ryabinin , Thomas Sailer , linux-hams@vger.kernel.org, "Jason A. Donenfeld" , Richard Henderson , linux-alpha@vger.kernel.org, Russell King , linux-arm-kernel@lists.infradead.org, Catalin Marinas , Huacai Chen , loongarch@lists.linux.dev, Geert Uytterhoeven , linux-m68k@lists.linux-m68k.org, Dinh Nguyen , Jonas Bonn , linux-openrisc@vger.kernel.org, Helge Deller , linux-parisc@vger.kernel.org, Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Paul Walmsley , linux-riscv@lists.infradead.org, Heiko Carstens , linux-s390@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org Subject: [patch 17/38] ext4: Replace get_cycles() usage with ktime_get() References: <20260410120044.031381086@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 Cc: "Theodore Ts'o" Cc: linux-ext4@vger.kernel.org --- fs/ext4/mballoc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -1289,7 +1289,7 @@ void ext4_mb_generate_buddy(struct super ext4_grpblk_t len; unsigned free = 0; unsigned fragments = 0; - unsigned long long period = get_cycles(); + ktime_t period = ktime_get(); /* initialize buddy from bitmap which is aggregation * of on-disk bitmap and preallocations */ @@ -1328,7 +1328,7 @@ void ext4_mb_generate_buddy(struct super clear_bit(EXT4_GROUP_INFO_NEED_INIT_BIT, &(grp->bb_state)); - period = get_cycles() - period; + period = ktime_get() - period; atomic_inc(&sbi->s_mb_buddies_generated); atomic64_add(period, &sbi->s_mb_generation_time); }