diff mbox series

[3/7] mm/swap_state.c: use helper macro K()

Message ID 20230804012559.2617515-4-zhangpeng362@huawei.com (mailing list archive)
State New
Headers show
Series cleanup with helper macro K() | expand

Commit Message

Peng Zhang Aug. 4, 2023, 1:25 a.m. UTC
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/swap_state.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

David Hildenbrand Aug. 7, 2023, 3:19 p.m. UTC | #1
On 04.08.23 03:25, Peng Zhang wrote:
> 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/swap_state.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/swap_state.c b/mm/swap_state.c
> index 5a690c79cc13..01f15139b7d9 100644
> --- a/mm/swap_state.c
> +++ b/mm/swap_state.c
> @@ -63,9 +63,8 @@ static atomic_t swapin_readahead_hits = ATOMIC_INIT(4);
>   void show_swap_cache_info(void)
>   {
>   	printk("%lu pages in swap cache\n", total_swapcache_pages());
> -	printk("Free swap  = %ldkB\n",
> -		get_nr_swap_pages() << (PAGE_SHIFT - 10));
> -	printk("Total swap = %lukB\n", total_swap_pages << (PAGE_SHIFT - 10));
> +	printk("Free swap  = %ldkB\n", K(get_nr_swap_pages()));
> +	printk("Total swap = %lukB\n", K(total_swap_pages));
>   }
>   
>   void *get_shadow_from_swap_cache(swp_entry_t entry)

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/mm/swap_state.c b/mm/swap_state.c
index 5a690c79cc13..01f15139b7d9 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -63,9 +63,8 @@  static atomic_t swapin_readahead_hits = ATOMIC_INIT(4);
 void show_swap_cache_info(void)
 {
 	printk("%lu pages in swap cache\n", total_swapcache_pages());
-	printk("Free swap  = %ldkB\n",
-		get_nr_swap_pages() << (PAGE_SHIFT - 10));
-	printk("Total swap = %lukB\n", total_swap_pages << (PAGE_SHIFT - 10));
+	printk("Free swap  = %ldkB\n", K(get_nr_swap_pages()));
+	printk("Total swap = %lukB\n", K(total_swap_pages));
 }
 
 void *get_shadow_from_swap_cache(swp_entry_t entry)