All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: define flags using bit numbers
@ 2020-10-30 18:57 Hui Su
  0 siblings, 0 replies; only message in thread
From: Hui Su @ 2020-10-30 18:57 UTC (permalink / raw)
  To: akpm, linux-mm, linux-kernel

These flag is meant the bit numbers, they are
used like '(type & SLOTS_CACHE)' and so on.

Define these flags using bit numbers instead of
hardcoding powers of 2, which maybe better.

No change in the actual values.

Signed-off-by: Hui Su <sh_def@163.com>
---
 mm/swap_slots.c | 4 ++--
 mm/swapfile.c   | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/swap_slots.c b/mm/swap_slots.c
index 0357fbe70645..18e7a01fd35c 100644
--- a/mm/swap_slots.c
+++ b/mm/swap_slots.c
@@ -47,8 +47,8 @@ static void deactivate_swap_slots_cache(void);
 static void reactivate_swap_slots_cache(void);
 
 #define use_swap_slot_cache (swap_slot_cache_active && swap_slot_cache_enabled)
-#define SLOTS_CACHE 0x1
-#define SLOTS_CACHE_RET 0x2
+#define SLOTS_CACHE		(1 << 0)
+#define SLOTS_CACHE_RET	(1 << 1)
 
 static void deactivate_swap_slots_cache(void)
 {
diff --git a/mm/swapfile.c b/mm/swapfile.c
index c4a613688a17..a0476c121c0e 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -113,14 +113,14 @@ static inline unsigned char swap_count(unsigned char ent)
 }
 
 /* Reclaim the swap entry anyway if possible */
-#define TTRS_ANYWAY		0x1
+#define TTRS_ANYWAY		(1 << 0)
 /*
  * Reclaim the swap entry if there are no more mappings of the
  * corresponding page
  */
-#define TTRS_UNMAPPED		0x2
+#define TTRS_UNMAPPED		(1 << 1)
 /* Reclaim the swap entry if swap is getting full*/
-#define TTRS_FULL		0x4
+#define TTRS_FULL		(1 << 2)
 
 /* returns 1 if swap entry is freed */
 static int __try_to_reclaim_swap(struct swap_info_struct *si,
-- 
2.29.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-30 18:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30 18:57 [PATCH] mm: define flags using bit numbers Hui Su

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.