From patchwork Wed Jul 31 12:44:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 13748712 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 599FDC3DA64 for ; Wed, 31 Jul 2024 12:51:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 240286B0099; Wed, 31 Jul 2024 08:51:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CBBC6B009A; Wed, 31 Jul 2024 08:51:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EC2586B009B; Wed, 31 Jul 2024 08:51:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id CBA956B0099 for ; Wed, 31 Jul 2024 08:51:05 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7BBE1A02F3 for ; Wed, 31 Jul 2024 12:51:05 +0000 (UTC) X-FDA: 82400032890.27.EBF3EDE Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf12.hostedemail.com (Postfix) with ESMTP id 5111340021 for ; Wed, 31 Jul 2024 12:51:02 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@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=1722430208; 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=Mq4/yA+8opzcyJt5hfobQHkz+fx2h8N/VaShcHkF2v0=; b=whCt+gtJzdpXnysC5Y/bHuibr7aIX9LMU573MAJwkVVew4LZvj3ZeI1qvtDZXkrYZNNKhq 8Uu7vob4JLphAA38t9uj1fOSWJpBdG+uSDwPDptskOHbTClMgj4UvieLRuP63FPw9CSP0W +9MT1ByAr3cdn14zNZzFf4LsFvk1c+I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722430208; a=rsa-sha256; cv=none; b=UoS731ddeYa812rPUhmPog5BamML+5o+cIrh+KA9+oWulNlXWFz2o/MfeehPr1PxGLLlYB E7Y2UnMHev26pfzuXwPqwA+/DuYSZFjpotmTryEEUE+m/FSVYh0Wkq+QnMWpPov3IAxEF8 0WMBRDR5YKQ24hYXVLUNgTKHaNqWev0= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=none; spf=pass (imf12.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WYsQc3847zxW1g; Wed, 31 Jul 2024 20:50:48 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 2933C180AE3; Wed, 31 Jul 2024 20:51:00 +0800 (CST) Received: from localhost.localdomain (10.90.30.45) by dggpemf200006.china.huawei.com (7.185.36.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 31 Jul 2024 20:50:59 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Alexander Duyck , Andrew Morton , Subject: [PATCH net-next v12 09/14] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Date: Wed, 31 Jul 2024 20:44:59 +0800 Message-ID: <20240731124505.2903877-10-linyunsheng@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20240731124505.2903877-1-linyunsheng@huawei.com> References: <20240731124505.2903877-1-linyunsheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.30.45] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemf200006.china.huawei.com (7.185.36.61) X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 5111340021 X-Stat-Signature: s7ouyji7i8nppbj5wqksjymftnx5i74u X-HE-Tag: 1722430262-199461 X-HE-Meta: U2FsdGVkX1/wWvpEYkr3tY1yto9WzeNp1c+3DwVghY/VugxAcB8Elfl5N1h1R7l6zKDHrJH4Rl1OLY/Gl2u/Kzu3chm3RXv60MW0aeWb1TkYBQ0dkkUy8vXCX/UQX8JnMsOLU5AMXsdq2yWtiYyt0+fZLgxZP1mcynkaUHnEW/ORf82nuQYD5PYKrx8iHb09q5OukheQCy+yBh3pffjUm/kauKrYaatuX12Tuejox393uxsmw2QyOZDjCW8+69sKo8peoCfDFBycVqYpfsLFr6voJcQOIhwsrojSE01slTWyf5SynOzBQSv+VuK1IsGusMpmPvO34pRNwv+ctbaotaw2SSHj+KeYqy/7pPhqfzTulhTzv2niItiSMbfG5al919yHoEpJKdiD80NKx47d4wqhFiBdVm1f5xVnXvlq7nqqUWsdF85akglda8y/v+LSsnGrc/C1yWMgSmCdvEP8cUiI1DPoNU+Qg+hQowYfDUu5+S6dFAHBGGzpOtgaExc29tfP1n+5rKzScAJyVDvxOQOTMTQBffMDNbLZQaR8XhTrrwCRPz3bjINyrbhXNZ6Lf6DV8KUv9D9qjcw5m0OB9X3noZWERmfGTkF21y5Wtg/JQwLDOtLp576kOMEPOzsfao+SaWfnJxPJi/pWrxCrXei9fp9qtMxFNkBLAEvAKskyTg51yggnnAvq5TaVxlV4eVdXpZejwAaggxSiSxtDqRWnE/6a2+0SxG7pUo+KNyq/4NlgR4QraVjJeR0kg+JEe8IJ27GN7ZoDHDgaGukwAJ0RC/lo5esO/sbDODR8fxkzBA9XhkF49ZH3aInMfYI0jpRthJRIlbzw78a7pElUsx0ZIeJuPdrux7QAnL4xVzxQkTETrTqLbL6W200SjEfnD3eqrrDDUm/XD4ujXsJG/F/tOiqm9/C4dERyikA+wZrOkVcMMZU+qfssso/6X9uvMAqKzcDykI0zQuuh93C K5J5gH2d 579lw+GHZH7UvDLSgJ8q+sbs+zcldJC3Cjbuwal9P4OcE54eFdYCtvOC9zmEvdX7BR+sJHuqNtJdMZxdB+rsP7hi+dMepjkBwrNKJHLcY+Q50nk6rEWdhp+i1wB1/663xzNg1bLljpQaQ20aLQZ+FbmGKxapzjn3XL5OyCo64GiJ6Oy1XHoaQxEr39M5cWaY0Jfwfq+Ax0OHjg4BxGpcTHLCDtjSxFVcoRErbtfrUWSFopHLKhtZQMyiaagj1T8AfYm9YW7cyXzhu+IwMFik2iakvEFhxDTBIhmN6 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: List-Subscribe: List-Unsubscribe: There are more new APIs calling __page_frag_cache_refill() in this patchset, which may cause compiler not being able to inline __page_frag_cache_refill() into __page_frag_alloc_va_align(). Not being able to do the inlining seems to cause some notiable performance degradation in arm64 system with 64K PAGE_SIZE after adding new API calling __page_frag_cache_refill(). It seems there is about 24Bytes binary size increase for __page_frag_cache_refill() and __page_frag_cache_refill() in arm64 system with 64K PAGE_SIZE. By doing the gdb disassembling, It seems we can have more than 100Bytes decrease for the binary size by using __alloc_pages() to replace alloc_pages_node(), as there seems to be some unnecessary checking for nid being NUMA_NO_NODE, especially when page_frag is still part of the mm system. CC: Alexander Duyck Signed-off-by: Yunsheng Lin --- mm/page_frag_cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/page_frag_cache.c b/mm/page_frag_cache.c index aa6eef55bb9c..a24d6d5278d1 100644 --- a/mm/page_frag_cache.c +++ b/mm/page_frag_cache.c @@ -48,11 +48,11 @@ static bool __page_frag_cache_refill(struct page_frag_cache *nc, #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) gfp_mask = (gfp_mask & ~__GFP_DIRECT_RECLAIM) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY | __GFP_NOMEMALLOC; - page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, - PAGE_FRAG_CACHE_MAX_ORDER); + page = __alloc_pages(gfp_mask, PAGE_FRAG_CACHE_MAX_ORDER, + numa_mem_id(), NULL); #endif if (unlikely(!page)) { - page = alloc_pages_node(NUMA_NO_NODE, gfp, 0); + page = __alloc_pages(gfp, 0, numa_mem_id(), NULL); if (unlikely(!page)) { memset(nc, 0, sizeof(*nc)); return false;