From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) (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 632B73C3453 for ; Fri, 10 Apr 2026 12:19:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=172.234.252.31 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775823596; cv=none; b=tiUrNXS0l3sZqk7uCL7PAXXaiQpFxbGa5pICgIo7uHI0PCoMxq0J0P3neD8olXqQtF9TXeSIGN0kGDyPuIjQFSJWRCAygVTodtUSi09rC89tFh5mQi30XvJjfJwMogWMQWvmvEGAUf0dnS7r2SlGwjMdGcKCKfdKmIaIZjWclH8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775823596; c=relaxed/simple; bh=QF8xu2w1ekYQn9h8hXu1i+73iAYxDniq8hK08qkXVok=; h=Date:Message-ID:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=U0ni4IVhZM9JQwui+x08wdpskO1AO7pCg8aDYflEFOcWlmt5ySXuTGOBFALBtcqE8JlsWvhUCPA9hGmUlMyZncqRpc3kevrNFx9r8Lwv/dlcQtw8T1WYUcYbK6JZPGeS7rMUtGaG9GQcvOea6FJqOB0g/IQckMhLUyope8dSGCM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jdPhw8GN; arc=none smtp.client-ip=172.234.252.31 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jdPhw8GN" Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 3B39F41A7C; Fri, 10 Apr 2026 12:19:55 +0000 (UTC) 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: linux-m68k@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); }