linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peng Zhang <zhangpeng362@huawei.com>
To: <linux-mm@kvack.org>
Cc: <akpm@linux-foundation.org>, <wangkefeng.wang@huawei.com>,
	<sunnanyong@huawei.com>, ZhangPeng <zhangpeng362@huawei.com>
Subject: [PATCH 2/7] mm/swapfile.c: use helper macro K()
Date: Fri, 4 Aug 2023 09:25:54 +0800	[thread overview]
Message-ID: <20230804012559.2617515-3-zhangpeng362@huawei.com> (raw)
In-Reply-To: <20230804012559.2617515-1-zhangpeng362@huawei.com>

From: ZhangPeng <zhangpeng362@huawei.com>

Use helper macro K() to improve code readability. No functional
modification involved.

Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
---
 mm/swapfile.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/mm/swapfile.c b/mm/swapfile.c
index 0df94c4000ea..d46933adf789 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -46,6 +46,7 @@
 #include <asm/tlbflush.h>
 #include <linux/swapops.h>
 #include <linux/swap_cgroup.h>
+#include "internal.h"
 #include "swap.h"
 
 static bool swap_count_continued(struct swap_info_struct *, pgoff_t,
@@ -2635,8 +2636,8 @@ static int swap_show(struct seq_file *swap, void *v)
 		return 0;
 	}
 
-	bytes = si->pages << (PAGE_SHIFT - 10);
-	inuse = READ_ONCE(si->inuse_pages) << (PAGE_SHIFT - 10);
+	bytes = K(si->pages);
+	inuse = K(READ_ONCE(si->inuse_pages));
 
 	file = si->swap_file;
 	len = seq_file_path(swap, file, " \t\n\\");
@@ -2861,8 +2862,7 @@ static unsigned long read_swap_header(struct swap_info_struct *p,
 	}
 	if (last_page > maxpages) {
 		pr_warn("Truncating oversized swap area, only using %luk out of %luk\n",
-			maxpages << (PAGE_SHIFT - 10),
-			last_page << (PAGE_SHIFT - 10));
+			K(maxpages), K(last_page));
 	}
 	if (maxpages > last_page) {
 		maxpages = last_page + 1;
@@ -3184,8 +3184,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
 	enable_swap_info(p, prio, swap_map, cluster_info);
 
 	pr_info("Adding %uk swap on %s.  Priority:%d extents:%d across:%lluk %s%s%s%s\n",
-		p->pages<<(PAGE_SHIFT-10), name->name, p->prio,
-		nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10),
+		K(p->pages), name->name, p->prio, nr_extents,
+		K((unsigned long long)span),
 		(p->flags & SWP_SOLIDSTATE) ? "SS" : "",
 		(p->flags & SWP_DISCARDABLE) ? "D" : "",
 		(p->flags & SWP_AREA_DISCARD) ? "s" : "",
-- 
2.25.1



  parent reply	other threads:[~2023-08-04  1:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04  1:25 [PATCH 0/7] cleanup with " Peng Zhang
2023-08-04  1:25 ` [PATCH 1/7] mm: remove redundant K() macro definition Peng Zhang
2023-08-07  8:31   ` Kefeng Wang
2023-08-07 15:20     ` David Hildenbrand
2023-08-08 10:44     ` zhangpeng (AS)
2023-08-04  1:25 ` Peng Zhang [this message]
2023-08-07 15:18   ` [PATCH 2/7] mm/swapfile.c: use helper macro K() David Hildenbrand
2023-08-04  1:25 ` [PATCH 3/7] mm/swap_state.c: " Peng Zhang
2023-08-07 15:19   ` David Hildenbrand
2023-08-04  1:25 ` [PATCH 4/7] mm/shmem.c: " Peng Zhang
2023-08-07 15:19   ` David Hildenbrand
2023-08-04  1:25 ` [PATCH 5/7] mm/nommu.c: " Peng Zhang
2023-08-07 15:19   ` David Hildenbrand
2023-08-04  1:25 ` [PATCH 6/7] mm/mmap.c: " Peng Zhang
2023-08-07 15:19   ` David Hildenbrand
2023-08-04  1:25 ` [PATCH 7/7] mm/hugetlb.c: " Peng Zhang
2023-08-07 15:20   ` David Hildenbrand
2023-08-04  3:39 ` [PATCH 0/7] cleanup with " Matthew Wilcox

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=20230804012559.2617515-3-zhangpeng362@huawei.com \
    --to=zhangpeng362@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=sunnanyong@huawei.com \
    --cc=wangkefeng.wang@huawei.com \
    /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