From patchwork Fri Aug 4 01:25:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13341042 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 EC984C001DB for ; Fri, 4 Aug 2023 01:26:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 475AA28022C; Thu, 3 Aug 2023 21:26:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 118C82802B0; Thu, 3 Aug 2023 21:26:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9B7F2802AD; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A3C032802AE for ; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 617341208CF for ; Fri, 4 Aug 2023 01:26:14 +0000 (UTC) X-FDA: 81084681468.05.6DF293D Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf16.hostedemail.com (Postfix) with ESMTP id E1838180017 for ; Fri, 4 Aug 2023 01:26:11 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 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=+8g1b6TftXOVa5lWHV0URGbicYA2jZG3gH15t6nxASc=; b=P82rBK7kulyT7q3uMI0MlXch4QJEGDo3NR6qhW0gTco6aWjifrXcZ6ySMLX2HyoO70ybZU oN6+VcFLsHUo5KaMMj91sJw5lvaeTCvuv5APp9zujQnxSBSCxgxo9HaTeGXgP7VkFBcgFP 2VPgcQwWJls5EVvSfqdzZwWRafzXLsg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691112372; a=rsa-sha256; cv=none; b=tY/zHNkKw5Q8JSxKhfle7fi0o/97Gj8A/8iobE/7WyH6omfvEsmKk0IEH44LR/DqSvweXW QSiy7BCSZsGB82pLavPc97GV0o6Gy3cHxN0VOMa6favUk1ybuCtPSuytz09rGM73kC1goH SzNlKKWd2OUDAmkGzRcU2u5iFcg6rIc= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 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.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RH7LR085Qz1KCCk; 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:06 +0800 From: Peng Zhang To: CC: , , , ZhangPeng Subject: [PATCH 1/7] mm: remove redundant K() macro definition Date: Fri, 4 Aug 2023 09:25:53 +0800 Message-ID: <20230804012559.2617515-2-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: E1838180017 X-Rspam-User: X-Stat-Signature: w1kim7indzwang19taxncsmwt5mdc4iu X-Rspamd-Server: rspam03 X-HE-Tag: 1691112371-252997 X-HE-Meta: U2FsdGVkX1+TxE/GFpUDBbSqbXS2P52p2ukJOcBbidT1UO8lgTDHc1Xpz9HSb2evEDT31FhjAPlh3lBFWMxM+r0V3q/Uffo0GthevaUMkoxUg7513WrLxpUt2gvms/5USeMDA9ktNfsIk+iYvV0DYcVCZdcXg0M6YfrWj+R5H8X2/ZofSWEmZMR05C/GUkj0z3EszskznvtK8N0jDELFe8c2cWVczPcXY+sKEMyuDYa9n/ovgFbNbteNIKkOrTtqscgNVN384DyMLOg354/srd2UFuEWyC6y4ekvYPpUjj6TQ2ra4SksX7VuqCMja7+pW3+uhXPpOAshG5tVvewFfHbhj+ee6CpRcEZ5Q3xFuqYh+4fnhSdWoPZyfsnLZM1XCs8ERyROZZ5zimXW2D28B6ATEPI3comlpHud7MM24KoCC61oBc2+MWhzgp7J0ehqbmq/VNGueWYyk/OVD3svrTLxz3mbL9dI05QQUkxgbWcNqBE9H1iox0x/6fNwfJdsRIk33EvtbaR/y0tShNOnScS7I1wraSo6bGNujjKWdR1IgjtjENwN/aNWxriTQYGo3U/07eghhQPQhOBOfx2mAN4AOp14RFESbVvM4r0rnJFTLBC/ofLSt6SyVuNHOwgYrnXfUtUxFYoiWDjCeE8DpnSgJhK8sp7stXRHxFLLc30O+QwNOdqCs96+fHDutCqILdqcJj9bPpzcqgZLb2zPtrD47t/qrbLchNBgunxT9VhjJTK1nn+fBs6MgN4ZptLBRIPSU1zxjS4dtA0P60OCB2YiQ8oJWkRDEm2Hyn9XIxR+LogNvQy8VntdNR8ec0Qv0R6wJ5TSGOu84TRLlbIeqbyjzIgdPuSzEWvmqXz5rK+SKT92hMwAXSz9oNOyN9afMVpopaZ5ZrZCaeXH6FCaseO8oNmI0Ck/lFH/PD1qy1jufC38gGnlfD+wpkyFtozuJHkgPwUyA8cUYgWH92M 3bAJX8zU qwouBDZUJDAwSewxUgeaPebVmXn/wddsJGGzapxJaZTU2LbOExUPPREm6vM+UuZEqcDkdf8GJgTHrw79eXjBtHguPAu3YEs9ZEqpXMB2bbe7rq2H6wikUyzOUBCsqKnDPK7Uec36ScQ5oe/o= 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 Since commit eb8589b4f8c1 ("mm: move mem_init_print_info() to mm_init.c"), the K() macro definition has been moved to mm/internal.h. Therefore, the definitions in mm/memcontrol.c, mm/backing-dev.c and mm/oom_kill.c are redundant. Drop redundant definitions. Signed-off-by: ZhangPeng Reviewed-by: David Hildenbrand --- mm/backing-dev.c | 3 +-- mm/memcontrol.c | 1 - mm/oom_kill.c | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 3ffc3cfa7a14..fc44bfbf785e 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -16,6 +16,7 @@ #include #include #include +#include "internal.h" struct backing_dev_info noop_backing_dev_info; EXPORT_SYMBOL_GPL(noop_backing_dev_info); @@ -34,8 +35,6 @@ LIST_HEAD(bdi_list); /* bdi_wq serves all asynchronous writeback tasks */ struct workqueue_struct *bdi_wq; -#define K(x) ((x) << (PAGE_SHIFT - 10)) - #ifdef CONFIG_DEBUG_FS #include #include diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 1ff51d8df84a..e290e7ed05f3 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -1626,7 +1626,6 @@ static void memory_stat_format(struct mem_cgroup *memcg, struct seq_buf *s) WARN_ON_ONCE(seq_buf_has_overflowed(s)); } -#define K(x) ((x) << (PAGE_SHIFT-10)) /** * mem_cgroup_print_oom_context: Print OOM information relevant to * memory controller. diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 612b5597d3af..471061a3a0f5 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c @@ -479,8 +479,6 @@ static DECLARE_WAIT_QUEUE_HEAD(oom_victims_wait); static bool oom_killer_disabled __read_mostly; -#define K(x) ((x) << (PAGE_SHIFT-10)) - /* * task->mm can be NULL if the task is the exited group leader. So to * determine whether the task is using a particular mm, we examine all the 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" : "", From patchwork Fri Aug 4 01:25:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13341040 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 9917CC0015E for ; Fri, 4 Aug 2023 01:26:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9E682802B1; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D74D828022C; 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 B7CE728022C; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8B9402802AB for ; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 477B3401F9 for ; Fri, 4 Aug 2023 01:26:14 +0000 (UTC) X-FDA: 81084681468.07.460ACC4 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf15.hostedemail.com (Postfix) with ESMTP id CB81AA0010 for ; Fri, 4 Aug 2023 01:26:11 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@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=biqcidOLv6cLLJZRjdtOyS/dBbRhOlF1EvCFE9A/Mdc=; b=PPu+AbYoms+4NKq6s4DIhlaB/kpHk8+ekTCN2xCkWy4GXRj8BIjGYvhNQ75ivTDDr4v3Fv onC4FTtp0cMsLy4dZMe8/DxN7o5ynnObdXjFMHA2S+c0UMwj95cY6/b4scNxXgr6npKX9m Dsi0mgQH0dDu3n/TcK9gWI0fdSkoV4A= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf15.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691112372; a=rsa-sha256; cv=none; b=Qjtnp0Ee4zuyyZ+UTRBK0ylmeRoMoVzkibVDZgubzYgOMh6Ib9uOOi4tZ9OqB4mJ/kulKJ LoMo6086cv7eLu+EMf4POu9GLiB9EHE//6uxnpFBGPJt388rQFZb3odU1G64PI0HtEija7 JedpeTLIJbOOT3I69u9/iGvZ07J6O/I= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RH7Hj5N6hzNml4; Fri, 4 Aug 2023 09:22:41 +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 3/7] mm/swap_state.c: use helper macro K() Date: Fri, 4 Aug 2023 09:25:55 +0800 Message-ID: <20230804012559.2617515-4-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: CB81AA0010 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: eeoj6wcijxmghxtxdsoy9mnodbs7sgzr X-HE-Tag: 1691112371-196564 X-HE-Meta: U2FsdGVkX185ycWE4FYqSuwRfgxwMCcp10yyI43Io3o2zAdhlxOUv2ENnKoCCntK0wjvybfzd5PwGmhIFOI9wrywiSHghkudN0yEJ8IvkPSAzWbWRsoEIrkKzouKBnEv5GhG5pjpcTJfG1oOCMVktQ3ip5ZS9zYZnoN8X9KTgXULvYkqmGMIBYkbwxG8mlj1+1vxhc840Wk5sWnPgJd3wgXIc5TCKhTkVk7tqYBBaafIOOXjtpl0Pw8rT4WLIDKE9clL3Dby8HsrmuaMA3M2+Wq0ENWoI3AAb/LZIPlfHTkHfZ4/a26WrEwoxc3GOC31wgUxdC+nMqiI/StaU+035Zf00oK6mcWwEhuCejxy58UZR5lCKARqQGg7jmPzyjyfRG05g6AlCO6jkfUKZ503/5iUq4J2lFttWb0uXw5F+t+yw4UCOFYLmRSfFZu6Zy7Wydsrx2MTVhjpEubikbDKwMTpaXOumvLKDhhX8gg+Q7C/1NviAHWGgJKky+R5CTqCN0QBxiBvm1wybg9McgKWNf8a0iJL49cWXsHR0cTsyJ0Lh2lfTUe0wP5nUx7MHDWA1mn0QXlS6FShU5v/4qnviY4Koz6ACWBK/dCggACE/y6tD6KMrGJs29GZB5UVZdw8R30nHzuRfbdGVLkJobCh9m6aywpB+/NGMJS6y94XkE+UuvkJ3GHGfV16RidB7VlHWdm01kK3aEXn0g3D+VsVWpKQodzWodICzDFvNP5HUMT5m6Dvve/32p95S1fp2Y+ePEsiIjo000+TRimlGkcGYEChAkoqLAPPaGD9yWpSIuxRh9iUC5oQK6kGSkdviWnUagAaBJkNOUi9crJU8oG67hC4xxsCPUgHzja/StgxWo45ImusR2uywbn+I1EGNAcJL5erL0Um/PPphBerE5hwmMNk88Id49z6q1D6FmqXMw2udD3F1xSeNDtc+NEA9qH4vfdsi1N/jTKFmS+paIL jtASojsz zO2JjaPPzs8KS59ZZBxz1p1oAUisf7WdKtRI1jpJxdWgTeZBTJEVqQwf6Qpmw3gG0rzHwKc3cI+d1XH+afw6VycJdTssKu3INgedK6Umb3+D/V3JXyLQfZ95P8m5nsARJ9XuegNonH+ZP0rx5OqGafY6uztSdUAohhNJ/OKS2ZOjTJN8d18YHHDWMQVcQ4iAUWNGn 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/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) From patchwork Fri Aug 4 01:25:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13341044 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 9B2D5C001DB for ; Fri, 4 Aug 2023 01:26:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 830242802B0; Thu, 3 Aug 2023 21:26:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FE562802AE; Thu, 3 Aug 2023 21:26:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1669028022C; Thu, 3 Aug 2023 21:26:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A485A2802AF for ; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 66B401212A1 for ; Fri, 4 Aug 2023 01:26:14 +0000 (UTC) X-FDA: 81084681468.04.290F3E5 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf20.hostedemail.com (Postfix) with ESMTP id 24EC91C0017 for ; Fri, 4 Aug 2023 01:26:11 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 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=Wce6KUcdZjC294h+qAqR9KunJTmmNBJXZjvQKoCWIv4=; b=dPnVqempVoQVXM8wg8kkY6Cx91cnk+gnyMroszZbWS7cWs+uZs7bTeoXsLyoaPuOwdallW Fed3hiOH0zsZo4RjfroV8Wq01S3RIL2kKOdwFflDUjhJDvodKYXTMWly3JhFdAcs6Qz3B5 czu5pzmjV9jN4Oe9S3Wo4jx2k+m86Tg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691112372; a=rsa-sha256; cv=none; b=CRPjFtlymDe/Z10giKpKSUnvXBryyiDksnVFMgBFjBPEKidacrqiXAJdnjdGmacb37PGv9 5csXRPRLXYm7tR7Xo8rhJOValOY8780vTfPla+d87qTxJEpTnpze4Xhxnmav1LqZXvYzd0 PCRyxnsFKGLF09KZnV3cHVSFi4wx9k8= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; spf=pass (imf20.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 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.53]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RH7LS4sFtz1KCDC; Fri, 4 Aug 2023 09:25:04 +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:08 +0800 From: Peng Zhang To: CC: , , , ZhangPeng Subject: [PATCH 4/7] mm/shmem.c: use helper macro K() Date: Fri, 4 Aug 2023 09:25:56 +0800 Message-ID: <20230804012559.2617515-5-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-Stat-Signature: fxiw4gkts1ify1prtudr953bptar549b X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 24EC91C0017 X-Rspam-User: X-HE-Tag: 1691112371-43586 X-HE-Meta: U2FsdGVkX19jPxR1SrvHf05lziqqCl04igM0WkI9uElb0JDpBplSvFWGeWKcOE90QQo42Yuz9AlK0E4d1QJgto26cCrWHFvGSsTrGpjD4WjDjlKV6zTf519OwPqClfiqjvL2bJpdE4HDNeaHTeDmvvZhV9pT8GAGCpqE39gDZDRF17ijyS2+dsZwrQGRrc5WQN//byw1T/h7BmV3vSAJpsVqyr7wCpVRgrFrKKj9q8ahkoOln6pyl6Q9lfmti2DpVCb6qGWITEM4JbdheOoLLX+bEbE8wr3tTt+Mx8pxXbql8d9MVu9/S5HA+Y1rKoLhbrcdyuEYWUNq19rAUGo6GsLl3OXSbOJw5RKIILxviB2V7rcjFhQN5q2ldNfamMDBOKMDoimWggrj8C8nVUUsnxem5Nihhj4TXQptOR+LXiHayZDUxV02t0qMvEqdt1PTXOeXnKSFONnZeP33Cy0Mxa1wcF9sBfyppXtJD8HYpQgVIeZor9OHw23Hj5r37HMml5TUu2odKn/mxxlwgOpY01LkXW2NYSmkB8xHBKuxlPR0s+3t5E3MVlx26SQDxBjOWvzrjkdCrIDZRVUaEveSur3SY1st7PJrmRGYxp8XUtIGHYyx5+e9gDXf8uHRLyXlHDpLSfG2JpdLtqgrJRScBrYqxSy1+RbKaVo7n6SCZjItBzjockcxAL026AmSjtvH7Q3hurc1Wqsat2eDWgwfFMFAyJgtWbOy/B9ZZakfAWv+cSRUYGlGlKT0JtvfQVsp/6Jiq0rcjWYpXvasPdD0BZJ5W47uJAxCHWKua19a1mp9JGDKBi9aE0KAJGTIX5BEP8+9GmKhj2gZbI8EpS54Y/61isLL8Stilyo1h0aMY43xQxM/hx4Z5+JMHwQYzGWu09MOUrwktKCNNQDFgPeS4TEFMgzdWbMaomm3sG4UBOHzpNYk+aRbCka7cQ81nWzifKoDIgsw6Cz+yEyfb59 jconb122 3gqxSnCWafMPsAzYSOgmhcxbSGe9H8xgEXy1c1YwMj7lqDuxV2jGxLcdWJi8mMx/gmj3tUB7nVtyqRK3O5Gq5+p9PaFXMSQQthQzJ3p3K+NAuXHFgChT9AH8QpyApo01XmGnOi/DL/Qi85AM= 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/shmem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 30e96dcd71a2..7a0c1e19d9f8 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3881,8 +3881,7 @@ static int shmem_show_options(struct seq_file *seq, struct dentry *root) struct mempolicy *mpol; if (sbinfo->max_blocks != shmem_default_max_blocks()) - seq_printf(seq, ",size=%luk", - sbinfo->max_blocks << (PAGE_SHIFT - 10)); + seq_printf(seq, ",size=%luk", K(sbinfo->max_blocks)); if (sbinfo->max_inodes != shmem_default_max_inodes()) seq_printf(seq, ",nr_inodes=%lu", sbinfo->max_inodes); if (sbinfo->mode != (0777 | S_ISVTX)) From patchwork Fri Aug 4 01:25:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13341043 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 4B77AEB64DD for ; Fri, 4 Aug 2023 01:26:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 61C242802AB; Thu, 3 Aug 2023 21:26:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 277E72802AF; Thu, 3 Aug 2023 21:26:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EED282802AE; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A87E32802B0 for ; Thu, 3 Aug 2023 21:26:14 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 79C021212AB for ; Fri, 4 Aug 2023 01:26:14 +0000 (UTC) X-FDA: 81084681468.04.9FC67C4 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf15.hostedemail.com (Postfix) with ESMTP id 5CBB9A0015 for ; Fri, 4 Aug 2023 01:26:11 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.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=JXkvt1bhEq1AJ2Xm6oqcZGFB5TUOlRnZ9UKgw3zkuyI=; b=tjtDKnDXk+D1r2OGkH4jUKOVYuo/eHMEvqM8ACyGZUkJ09IeGeNcSc8aBjMt5HnL93Jsmq wEgHR/nRvfTrW2Jng+b6SZOTsHgKvOuZ1om4H6/qOpCEkj1skuJ4jYj9D/92rsQiuagko2 1ld8zpJ8sXrMKOzd4dnvqQyBE9/0H8w= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691112372; a=rsa-sha256; cv=none; b=fK4+Wb1aMW7ByEKPBnwCEb5lWehy1zvCkki+1GJyLnqtoDoCQ6SWQ0CCOpc76uwOGbL6pF ON2yuNfDSO+xGeI0EDMAZCYgQspqbiBX4CwnPVPVSWIYxzL7OSS08wagb0gGJdQc8cWzHf mXN0sN3cIwQZkTtKR17DKYE46CEV8RQ= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.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.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RH7Hn5zBSztRjZ; Fri, 4 Aug 2023 09:22:45 +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:08 +0800 From: Peng Zhang To: CC: , , , ZhangPeng Subject: [PATCH 5/7] mm/nommu.c: use helper macro K() Date: Fri, 4 Aug 2023 09:25:57 +0800 Message-ID: <20230804012559.2617515-6-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: 5CBB9A0015 X-Rspam-User: X-Stat-Signature: aurmac1oupgo8ago3pdasygj88q7nxuo X-Rspamd-Server: rspam03 X-HE-Tag: 1691112371-363174 X-HE-Meta: U2FsdGVkX1+W9It1ja4PX+KzJJvFWkhooM2Up0uQ5oc3MsLgUiYNHn/UsRRQf4AsfgE0iZ4B4pcaB1wfMjOAOiS/vxhVcv19UpfnYeJWggfXl9CbzhKUGnVSKft6BLzS+9z82Li2ussH48J2w1qD62s5lXChSP196dPRjGXJq3E3EZ1azHtIGsqZi/ZD5igq6rOf3qjkOqhSF4PiF2gHwHjc4Yx/kfOQgq/MjgtzyIkhqcO2jqzVtv4asqL5f8AfC5XQhyJi3Q2hQu0+arxmRJmoIrNgtvsqXOmDEfB7EYFTpIMU01Azvu5tVxUuxmgsEx4mZrl0AEx/z/05mdSr02YiFeWUd40g+X1vDqpMfrScLjnYwpdktBf9UgNtKWmcboKBGb17KX2NIi7LrHYboKwf/pIQm48RRfvQ/ByhX9pBiEYPH2iStVB5Rr2gqXFUs8MmS5Qa1C6KdLaJtz9WjywOog3U9rOoUo9MdPl4xtLXd1LVUSAAeYcPRrURNhaVW43FMHX1IYWRfYQJj/W7Lj8mB93VOVyFBMW0V6YaZRzJcOUja/Usdn1/tkRlwMt48wqXCeJ37VhO0M0uGtPFlwPWSXX7u3toM+tuxSBFF72t+ec9XcQEpSYN828Mz8PfUS/63pgVDHBlq04p62CR6XJLos3bwsTnCq/4vOhPKocafBcz2WshCrKSscqXdBJliaeQHFq9/M6nRPZ4ZC0RLIezOePcx1fkPOqHbME6sku+3p209vXmK1V4h0z05T9zzi5I4+AQLTLuW0KQY/lZSyHStEkv18pASI2FxOhY7bkhv+KjWISBEE1ecEH8z5irNqcf8gHUeMUMqZKPvZB9bIyaDlx3Svu/VETEbXr32S/JYWitGfDmc06u4hzMDi+GEUbmKCwXsZWj1JiA02eMwuBasuwWrK1ElSjbQgM7HlYkOeIkQo6KPcyorSxuh/DeBgAnVTHxIQ/CyL/RPch 1gNNjLYf 0cuIb4Ys2ezUssiBoc4eLs5ZMI3bWOOBEv4fUje4YGbw1qVslTs2OVopQSJJoICFQjs7uRSuFrNk7kQjO0bx8Gt0s7RzOmfmZ02+EPRs/ZxpzhWR1U+jEryzaAmxHATnl3MhP1GoIOVqKJFG6AvzQ7LcUQQ== 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/nommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/nommu.c b/mm/nommu.c index 1fe0ee239860..8dba41cfc44d 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1800,7 +1800,7 @@ static int __meminit init_user_reserve(void) { unsigned long free_kbytes; - free_kbytes = global_zone_page_state(NR_FREE_PAGES) << (PAGE_SHIFT - 10); + free_kbytes = K(global_zone_page_state(NR_FREE_PAGES)); sysctl_user_reserve_kbytes = min(free_kbytes / 32, 1UL << 17); return 0; @@ -1821,7 +1821,7 @@ static int __meminit init_admin_reserve(void) { unsigned long free_kbytes; - free_kbytes = global_zone_page_state(NR_FREE_PAGES) << (PAGE_SHIFT - 10); + free_kbytes = K(global_zone_page_state(NR_FREE_PAGES)); sysctl_admin_reserve_kbytes = min(free_kbytes / 32, 1UL << 13); return 0; From patchwork Fri Aug 4 01:25:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13341045 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 91DEAEB64DD for ; Fri, 4 Aug 2023 01:26:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E3B942802AF; Thu, 3 Aug 2023 21:26:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC2752802AE; Thu, 3 Aug 2023 21:26:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8ABB2802AF; Thu, 3 Aug 2023 21:26:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id B85DF2802AE for ; Thu, 3 Aug 2023 21:26:15 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8B1E11CA51F for ; Fri, 4 Aug 2023 01:26:15 +0000 (UTC) X-FDA: 81084681510.01.07F42B5 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf10.hostedemail.com (Postfix) with ESMTP id 498ABC0005 for ; Fri, 4 Aug 2023 01:26:12 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.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=1691112373; 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=/QJ8JTEsvkjFBf5ovdOq/5GGQvpk0AjJnKJu+g0Psyg=; b=XWT/tR4Y0JVUkh4MOt7RDsBMQaKF77q+2aauYWMDYyWFWLmLQNjWRNmhmy4yS+n0Qyo+4h DTG7cZHaMYdGDg+m/EmziA2q9TBr4Iw5o9t14nw6FiYB9OcGvvrMrBSN5xqX4W88MYn4Vm kJe760b9wViyP9Hp4zbTshzfjUUUyTg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691112373; a=rsa-sha256; cv=none; b=yy+DXN9Z728hawJ+s3+DLzo9OmRnEa9NU2FhpH+nwcYgWS3wL4XNGCAUIVnOrpm1AA9bsF H2v/LyRr7OyISZ8FhtHdAnXEbHfT6snm5SRkNFBoIyd8Il4IhmE9Ac7yD17w8bdqZCgWNs RhdFle7xl2Ow+TTzytQLjkixTokNnSQ= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=none; spf=pass (imf10.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.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RH7LT0T5qzrS0X; Fri, 4 Aug 2023 09:25:05 +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:09 +0800 From: Peng Zhang To: CC: , , , ZhangPeng Subject: [PATCH 6/7] mm/mmap.c: use helper macro K() Date: Fri, 4 Aug 2023 09:25:58 +0800 Message-ID: <20230804012559.2617515-7-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: 498ABC0005 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: c5jpyczmx4csg5ffsoimx6bc5gaw6psr X-HE-Tag: 1691112372-849620 X-HE-Meta: U2FsdGVkX1+MbbRVNNd+wuXThxP/7b4SCdNk5qIhXq0qy6oY8MACY04xEypsUQYyjExvfigptuhzWzDdF+Gca3bMY0jW3i39Y0mtJMRVhB++ys0uSHjAbcG8YxmaudxYVITQ0o1QLi5/ZrxkgQtkSP5a/9ibiircouxqg5/ni1PwbdI8lUfcLfnPgPBNaPAk7CEZFm5y67QhtGT+xD5h/VUIAfSw1RtjllKK7vcQhhZ8fyrXl/2oe3/Wyedtv335454j9IG6yoTQZGWk4EU+nekpvpXqxE/2qEGtmde+PW5w+Y880AmKJ8AWDNK0S4PTQwWrN7R0yR4m2Oy0hky6PRuHP/vEdfZvNmn81ALQu4B9fQdaNTcsva3vF0gfCdymcSqTbGMtoKA1RHkpNYARAKAlQqr2T5mbtLBlowAV5ciqxrWF4moa5Gi2/3OdRpLHnGx0kuPXU7pRklcfq5ZMUAWL/7f4Z8cka/vIQQBNwPrnjGx1fk9nMYSeXqQSYk4zqUn2h2OE6HrxVPYqey71PnzO+RFzqal5NH/rfXZvQzXQPx6hvgZ/r0edUnKZRzMQhTzhV03HnZa4BWyDV7X204ku80ss7QkNZYtTk3axVssP+Q5xyy/Dn2OzZYF81//bpf2H5b0ncD5PLu8iHib1Km6j+YBhRsCdghC3YU06J1nnnT7ewYZdrSmKM9LHKv072BoAw/E1bfwYjEHVHnmovdIWvm6tzx66zlBnAWSAOA+KuT8blp80HxSQzEoblbaaUg4LzPIzeuwCegiNXv3uIoM3vpkaFaE73LiFNCacbbW/fjvwlvTsmYXbarG7eQmCDFqSghBRf+CILNmvMKWu0GApJ6jiagIFzmIZu5LC899R6czf38TDoS281CVQOral6NysuVm0FUcjPKqc0hDVLBsxEj07TqmkL4Ge5eHS5W/CWUF+uoExQ//8HaGitPX83k66w30gG9Se3iBbkIS Sx96VGPC TJLkSvISrSLZsTD6l7Pg9cHKcNx+DpXDK1Fjj+RtSidT3FmZA+BKIFd0jHbZVb2I5KL4GuCjnQzcZW9LPpIkJCg5LW2LoIL/XKQYE/2iBBZVkHV7i+RQQtYvZeJmPx4nlx9b0R/sJa6rR1WNcP6jP+b2Big== 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/mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index bc91d91261ab..35b6bc9c7c95 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -3785,7 +3785,7 @@ static int init_user_reserve(void) { unsigned long free_kbytes; - free_kbytes = global_zone_page_state(NR_FREE_PAGES) << (PAGE_SHIFT - 10); + free_kbytes = K(global_zone_page_state(NR_FREE_PAGES)); sysctl_user_reserve_kbytes = min(free_kbytes / 32, 1UL << 17); return 0; @@ -3806,7 +3806,7 @@ static int init_admin_reserve(void) { unsigned long free_kbytes; - free_kbytes = global_zone_page_state(NR_FREE_PAGES) << (PAGE_SHIFT - 10); + free_kbytes = K(global_zone_page_state(NR_FREE_PAGES)); sysctl_admin_reserve_kbytes = min(free_kbytes / 32, 1UL << 13); return 0; @@ -3850,7 +3850,7 @@ static int reserve_mem_notifier(struct notifier_block *nb, break; case MEM_OFFLINE: - free_kbytes = global_zone_page_state(NR_FREE_PAGES) << (PAGE_SHIFT - 10); + free_kbytes = K(global_zone_page_state(NR_FREE_PAGES)); if (sysctl_user_reserve_kbytes > free_kbytes) { init_user_reserve(); From patchwork Fri Aug 4 01:25:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13341046 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 1DC0EC001DB for ; Fri, 4 Aug 2023 01:26:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 033FF2802B2; Thu, 3 Aug 2023 21:26:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EADFA2802AE; Thu, 3 Aug 2023 21:26:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4DF32802B2; Thu, 3 Aug 2023 21:26:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B1A472802AE for ; Thu, 3 Aug 2023 21:26:16 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id B1DCE80877 for ; Fri, 4 Aug 2023 01:26:15 +0000 (UTC) X-FDA: 81084681510.28.A77B1FF Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf15.hostedemail.com (Postfix) with ESMTP id 88558A0006 for ; Fri, 4 Aug 2023 01:26:13 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 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=1691112374; 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=On+fyWYcHomC7T1HGv9P6UO9uc2ugReUJ6u2aA4IVsY=; b=1H2Ekuvz7/KWzL38IJwKaW6+C7RZMlF7XLSCzoVYVaNFmimMqZVeDxLEAAX0sONmap5KGr xLwrGi5poToL2ZRrR28y3YgTNvJre04R7KQn/3+Vrvzk2kCIPhFij68Nolxk11MdgrzHhf OyBpgt6NMN6EDKykU2Ga+UCDcEONTgk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691112374; a=rsa-sha256; cv=none; b=wdkxts4zn5C4XaOtFXgeZht889tqtg/JrRPoxy83etv3Q/DGN90aJfHSak8cgo9mmm1m3T raZrWuUGRknXyBcpKKSJC75EYtU/RfzhYaa2lhww0PeOsDemN6EpiKghSD5FgSU2NP7ujz bisgsxWJdpCo5XpVAiQw8U95uIoEzBc= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4RH7LV2blVz1K9TL; Fri, 4 Aug 2023 09:25:06 +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:09 +0800 From: Peng Zhang To: CC: , , , ZhangPeng Subject: [PATCH 7/7] mm/hugetlb.c: use helper macro K() Date: Fri, 4 Aug 2023 09:25:59 +0800 Message-ID: <20230804012559.2617515-8-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: 88558A0006 X-Rspam-User: X-Stat-Signature: ohtxp7s3fy6c7pgjpozza1471iw6sg6w X-Rspamd-Server: rspam01 X-HE-Tag: 1691112373-184297 X-HE-Meta: U2FsdGVkX18W97BX1aT2vUVkx3jiVhi/98sPsAohRGV9Zy/0IvFhg45Y94W9VqghPtHmLZIETWyuIGjdo+mDMrnn1RHETePng7A1I0iSDdTRLvx8JSo5J8EBxANJVyEuTk9jETaAHaUF5kPnesyxhD4OfEpUuSqyUPnv/jdhLeX8WjbQerCLUzU0AJBO+q6bti1uMMMy0yn/UDgYBD8+kHTqvg8ZJbS3ATdtTrkkZ/nqtyK7EHAu1u/7y1ev9wceHOGQhKCGiq4vTE96RfRF1rjFaypReZ72w54ob/r3mzFCPXLi6Uy3PLY7mpHIvMdIPU2ZKkMFs8bXGAR9NBwmdqnnz6HP4/Q/qaYHZtxb84AO9q0DDME5YOIaqPAfFrfqRp6nLoj5PZc6xUbD/560KF9g4xIi/g5QorC8zZBIAvMwjZtwJV780XLZRpsxv9psVnLpcEhH9MqtAKq06+EvAnNw1gNU1F3mRl++wzGlscXARvd5UJ6/LBhtpBp4QMVM+GDVI9DbDsjZ0KpvYmYS6+fiXOVDXIz+zDagc0qF/XS8iDQzfUJT8oga9FGFl9YDLBIygon3c+RE/RS8i/r1aj6YcHXi1XxUv0HBJoO4DQV2jfQ7ZSWHiUfbtzW8/jkHNTy7O+upzg7SpyvWFQij3V5mqTxYl3Ni73DKiq0WXAuBVA14EoVc+hSXZt8Z3HnR9o9JII3GMv6TWU3TZjoyyGIoTT/STuV9Q5hkWtRANIDsVmKdUKF8treInEzRQvg9xg0+dpucV66AsRbwqaBdmINGdyD1bRtZtm8UyQMfPbvjcoBBReWw3542JX89fZUslEjC9rlzhDniOis92HMd0G5ZuOceOE42ibFn/tG5W/NwIv3LUxm1TrvfOOdLapQBM0NRwUd7wAb0fe3VWXf9tOAVyvySjfa/sB0mI6YRNYr48/AHQgOdBJF916Pz5p/7WNbwkht6niItoiBYpRN 7/Z6cg77 eSbrLfUG1h690cy3C/9Lmku0+Rp1YG3gr0TdJscmI2J0qjT2Rs+lUEynX2EgQkv7FdwMICRMRa3iMePwfLpzjUhP1w4bb+4ejsjus0I/jBlEHf3dT9Pkj//kJKzawgi0o+D5V7xXH1Yc+CQ4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, 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/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index e327a5a7602c..941d1d497b65 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4775,7 +4775,7 @@ void hugetlb_show_meminfo_node(int nid) void hugetlb_report_usage(struct seq_file *m, struct mm_struct *mm) { seq_printf(m, "HugetlbPages:\t%8lu kB\n", - atomic_long_read(&mm->hugetlb_usage) << (PAGE_SHIFT - 10)); + K(atomic_long_read(&mm->hugetlb_usage))); } /* Return the number pages of memory we physically have, in PAGE_SIZE units. */