From patchwork Fri Aug 4 01:25:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13341039 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D15BEB64DD for ; Fri, 4 Aug 2023 01:26:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8C2962802AC; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 81CB928022C; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70B842802AB; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 59DC628022C for ; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 28699161326 for ; Fri, 4 Aug 2023 01:26:14 +0000 (UTC) X-FDA: 81084681468.06.79AEAB8 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf24.hostedemail.com (Postfix) with ESMTP id B8EFA180014 for ; Fri, 4 Aug 2023 01:26:11 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691112372; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HxzIi9sNnjZVQr27h6rc5DtJNHbGJ4hMyKiGdaDjpUQ=; b=CJzSLFXFlN8bKQg1isCXKQKnW2L14FUvwM5d0+TlvXPunKuLf8Tr2sDMBkPoOYEgM1ALla 37d4rvxG2CcHWFwXFvCYqV+IXkoJ+cDp07WGPgVuwZf/TS5id4djwbd7nL2c+JZlDhaPUV jCAC6Yvxbs8RPZ8X5R9elrXncLVxkw8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691112372; a=rsa-sha256; cv=none; b=Q9sVm0Qe62ruRS8pn387J9ZXjJaGM39d3enQzDnT9J0DjYpfYdZWtybcbAA97BK7jKZUdA LJ5GoeheP2qVVnuu0+4+fn7O1wLdj50Bf+nM0r7w7ZgvAEdcUA1ouy4jFYQLUnMgDbOolo mIjVziDuMT7Wa/qIZXLv1Zmns1EUBd8= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; spf=pass (imf24.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RH7LQ5tx3zrRsT; Fri, 4 Aug 2023 09:25:02 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 4 Aug 2023 09:26:07 +0800 From: Peng Zhang To: CC: , , , ZhangPeng Subject: [PATCH 2/7] mm/swapfile.c: use helper macro K() Date: Fri, 4 Aug 2023 09:25:54 +0800 Message-ID: <20230804012559.2617515-3-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230804012559.2617515-1-zhangpeng362@huawei.com> References: <20230804012559.2617515-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: B8EFA180014 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: b5ryhu7pcg3rbm1qxtjiancn1u4godmq X-HE-Tag: 1691112371-210827 X-HE-Meta: U2FsdGVkX19W70wV6a8vnCeHWP5DRyllOzKmj7Ls9Bkf9pzN6tsY3k5KgrjgHNyL6a8CCV73hTDfEIscuSVSW7HdskrL8Z5zWo+JE93GPOyScl/ZevPfYP82yYEX0qe9m/3f5LcUkNmMBPVfu6/oyFyWqGrLSC18uq9NHmg7r4PxmwzwKSAudnBNxOHjKkuzIeedd/JAWeUp59VZGSng4gzKqm3HWKMk2jrtSGAZcMbSmnR9NYtBhDO3idOiirTKIpiIVllDkVR9lSXsREt+4roZHGR3g4S1IKHRfgqlIlr99oW5pX3At/N6TU/W8yvFOrXI1h3A5aYnPKYX85+wkKuik0vDPFjIQ4HlOhX/n0x0G40sdSoSE5CtbfJRK9nlJbXcVVd57YJ0cwcJJNsZYO8OoA1QMvgnckb8kZUo4EOb0H6YlJQZUJX/8JLKbeWJBw5YoFJf7UTOGuhGUM+WNmcEsLL7WuJrS6fKjY6hQrdmFf4VIuEfT2a3Hj96EMZCOlMcXZh6zGyivqvoi/6dmOzCcEqDsnFCz+OPlfBV0ELFYVdRRvQ61KbtS0jby69z6MkRC2yw61lud/6M9mEMSPOSZqtDFhgOosoua2by0IpmvM2KL3YfcWuYh8LIRf9pw0lXaVRA2iCe1BZwW7x99+UvWEok4Btccq+f85MSRKo1ABNOSg2J30WFKeg6qWM733Edi+B0mF3csRL5MEdJczH8mV0nlWzFubfmlnkiizGcidp+//hMUVurqyftK4QbhnBzh7ZA7VqHDabggY0w9qXqlNiYV9NlYnkq6pQM0Yrk70CKwwc7lF7Onj+XyaOagGFfydiLZZnYe/7mbMZYUfZa695X1+hxzOkL/tbCxkVrFuy1/TpRWNLdMWISAMRxaZApWFuUH/n+6OvKBslSDs+NjPi87nV371rZuUNzk+Sd/vYLJ4Vjj/j1sJtskGqnKlhC1u+Z5v04Qa3KCWj gl/xrEMT nmDZO5lADXmq2SUW/aALqas5cLuaMrxDKlTR7Vo/vqeX9lPDKMMGZ8XIBIxSSMA53ZSl9NFHboi4trgzICPnIVBPH4tzc+7l2tP5/sIJ2Z1AOh9kpWPXwUb3gbV04MHD1gr6B3fV2P/GNkqU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: ZhangPeng Use helper macro K() to improve code readability. No functional modification involved. Signed-off-by: ZhangPeng Reviewed-by: David Hildenbrand --- 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 #include #include +#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" : "",