[RFC PATCH V3 26/43] rv64ilp32_abi: file_ref: Use 32-bit width for refcnt

From: guoren
Date: Tue Mar 25 2025 - 08:46:31 EST


From: "Guo Ren (Alibaba DAMO Academy)" <guoren@xxxxxxxxxx>

The sizeof(atomic_t) is 4 in rv64ilp32 abi linux kernel, which
could provide a higher density of cache and a smaller memory
footprint.

Signed-off-by: Guo Ren (Alibaba DAMO Academy) <guoren@xxxxxxxxxx>
---
include/linux/file_ref.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/file_ref.h b/include/linux/file_ref.h
index 9b3a8d9b17ab..ce9b47359e14 100644
--- a/include/linux/file_ref.h
+++ b/include/linux/file_ref.h
@@ -27,7 +27,7 @@
* 0xFFFFFFFFFFFFFFFFUL
*/

-#ifdef CONFIG_64BIT
+#if BITS_PER_LONG == 64
#define FILE_REF_ONEREF 0x0000000000000000UL
#define FILE_REF_MAXREF 0x7FFFFFFFFFFFFFFFUL
#define FILE_REF_SATURATED 0xA000000000000000UL
@@ -44,7 +44,7 @@
#endif

typedef struct {
-#ifdef CONFIG_64BIT
+#if BITS_PER_LONG == 64
atomic64_t refcnt;
#else
atomic_t refcnt;
--
2.40.1