From patchwork Fri Sep 16 07:22:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978217 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 6C303C6FA90 for ; Fri, 16 Sep 2022 07:24:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7BE988000E; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 76D0C8000C; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 524DA80010; Fri, 16 Sep 2022 03:23:48 -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 3902A8000E for ; Fri, 16 Sep 2022 03:23:48 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 0DCA7AC620 for ; Fri, 16 Sep 2022 07:23:48 +0000 (UTC) X-FDA: 79917108936.23.3213C9E Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf28.hostedemail.com (Postfix) with ESMTP id CBC56C00CD for ; Fri, 16 Sep 2022 07:23:46 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MTQVT4H5LzBsQh; Fri, 16 Sep 2022 15:21:37 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 16 Sep 2022 15:23:41 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 12/16] mm/page_alloc: use helper macro SZ_1{K,M} Date: Fri, 16 Sep 2022 15:22:53 +0800 Message-ID: <20220916072257.9639-13-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313027; a=rsa-sha256; cv=none; b=BJUE70H/VPPPGFMqxWBEmCiTwSGjWMMDuCZJuhkHXTVXL52ZVYl0u1CjR/nSE9C5x77uiw 96yCKYT2ndWIPezA9k0SD6lUeRHzQqGPrN+deyT/6vl6JYkmFdxBrldOR+6t5HCkPlvzmQ a/ZRhprtm0/OH0sRUff8Zsu31wO2ZAQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313027; 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=VoRicsi7p/LDEWr9E2zFhGeztwX6q2BBM6g94oHJvVc=; b=hcmijf2DsucR/hRbcO9RFOtNqADiWcm8AY1NO9pucZHNQtpFv39a01yzikRXy/wc/Msc0Q /vb7AcR/++N/ZvzEitKeLH5nXuZ1Bj+72iomEt85eYMjkfg2gxE9TvZuwOMzYN7yRVII3/ yViLQblROzzuTfMx2b3UW0fQBnWfb2Q= Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: CBC56C00CD X-Stat-Signature: mug7q4t6d66bana3jpxmw81wy8tu7rcg X-Rspam-User: X-HE-Tag: 1663313026-417743 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: Use helper macro SZ_1K and SZ_1M to do the size conversion. Minor readability improvement. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand --- mm/page_alloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 6bdc98c7019f..67ec8a2e1db2 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7048,7 +7048,7 @@ static int zone_batchsize(struct zone *zone) * size is striking a balance between allocation latency * and zone lock contention. */ - batch = min(zone_managed_pages(zone) >> 10, (1024 * 1024) / PAGE_SIZE); + batch = min(zone_managed_pages(zone) >> 10, SZ_1M / PAGE_SIZE); batch /= 4; /* We effectively *= 4 below */ if (batch < 1) batch = 1; @@ -8523,8 +8523,8 @@ void __init mem_init_print_info(void) #endif ")\n", K(nr_free_pages()), K(physpages), - codesize >> 10, datasize >> 10, rosize >> 10, - (init_data_size + init_code_size) >> 10, bss_size >> 10, + codesize / SZ_1K, datasize / SZ_1K, rosize / SZ_1K, + (init_data_size + init_code_size) / SZ_1K, bss_size / SZ_1K, K(physpages - totalram_pages() - totalcma_pages), K(totalcma_pages) #ifdef CONFIG_HIGHMEM @@ -9049,8 +9049,8 @@ void *__init alloc_large_system_hash(const char *tablename, numentries -= arch_reserved_kernel_pages(); /* It isn't necessary when PAGE_SIZE >= 1MB */ - if (PAGE_SHIFT < 20) - numentries = round_up(numentries, (1<<20)/PAGE_SIZE); + if (PAGE_SIZE < SZ_1M) + numentries = round_up(numentries, SZ_1M / PAGE_SIZE); #if __BITS_PER_LONG > 32 if (!high_limit) {