[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250618070328.2192849-1-hezhongkun.hzk@bytedance.com>
Date: Wed, 18 Jun 2025 15:03:28 +0800
From: Zhongkun He <hezhongkun.hzk@...edance.com>
To: akpm@...ux-foundation.org,
mhocko@...e.com
Cc: linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Zhongkun He <hezhongkun.hzk@...edance.com>
Subject: [PATCH] mm: rename the oldflags and parameter in memalloc_flags_*()
The variable name oldflags can indeed be misleading, because
it does not store the complete original value of flags.
Instead, it records which flags from the given set are not
currently set. So rename it.
Signed-off-by: Zhongkun He <hezhongkun.hzk@...edance.com>
---
include/linux/sched/mm.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h
index b13474825130..6b4b54e8db92 100644
--- a/include/linux/sched/mm.h
+++ b/include/linux/sched/mm.h
@@ -322,21 +322,21 @@ static inline void might_alloc(gfp_t gfp_mask)
}
/**
- * memalloc_flags_save - Add a PF_* flag to current->flags, save old value
+ * memalloc_flags_save - Add a PF_* flag to current->flags, return saved flags mask
*
* This allows PF_* flags to be conveniently added, irrespective of current
* value, and then the old version restored with memalloc_flags_restore().
*/
-static inline unsigned memalloc_flags_save(unsigned flags)
+static inline unsigned int memalloc_flags_save(unsigned int flags_mask)
{
- unsigned oldflags = ~current->flags & flags;
- current->flags |= flags;
- return oldflags;
+ unsigned int saved_flags_mask = ~current->flags & flags_mask;
+
+ current->flags |= flags_mask;
+ return saved_flags_mask;
}
-static inline void memalloc_flags_restore(unsigned flags)
+static inline void memalloc_flags_restore(unsigned int flags_mask)
{
- current->flags &= ~flags;
+ current->flags &= ~flags_mask;
}
/**
--
2.39.5
Powered by blists - more mailing lists