linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hui Su <sh_def@163.com>
To: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] mm: define flags using bit numbers
Date: Sat, 31 Oct 2020 02:57:18 +0800	[thread overview]
Message-ID: <20201030185718.GA150073@rlk> (raw)

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



                 reply	other threads:[~2020-10-30 18:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201030185718.GA150073@rlk \
    --to=sh_def@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).