lkml.org 
[lkml]   [2020]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] mm: define flags using bit numbers
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

\
 
 \ /
  Last update: 2020-10-30 19:59    [W:0.202 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site