linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: rename the oldflags and parameter in memalloc_flags_*()
@ 2025-06-18  7:03 Zhongkun He
  2025-06-18 23:43 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Zhongkun He @ 2025-06-18  7:03 UTC (permalink / raw)
  To: akpm, mhocko; +Cc: linux-mm, linux-kernel, Zhongkun He

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@bytedance.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



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-06-19  4:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-18  7:03 [PATCH] mm: rename the oldflags and parameter in memalloc_flags_*() Zhongkun He
2025-06-18 23:43 ` Andrew Morton
2025-06-19  0:07   ` Kent Overstreet
2025-06-19  3:17     ` [External] " Zhongkun He
2025-06-19  4:16       ` Kent Overstreet
2025-06-19  4:36         ` Zhongkun He
2025-06-19  2:50   ` Zhongkun He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox