From patchwork Wed Jun 5 13:33:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 13686934 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 3A7B0C25B76 for ; Wed, 5 Jun 2024 13:36:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DE226B009D; Wed, 5 Jun 2024 09:36:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 540886B009E; Wed, 5 Jun 2024 09:36:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3432A6B009F; Wed, 5 Jun 2024 09:36:32 -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 17A476B009D for ; Wed, 5 Jun 2024 09:36:32 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D384A1A0BEF for ; Wed, 5 Jun 2024 13:36:31 +0000 (UTC) X-FDA: 82196934582.18.7215CAC Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf25.hostedemail.com (Postfix) with ESMTP id 58981A0004 for ; Wed, 5 Jun 2024 13:36:28 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717594589; 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=Q5lygQpHsNfD53k8GJVdoMYQB6GAVLoj7xg8lfwJgtQ=; b=8cEdB7ee8zfoVEUxc12dX0JXWri/LFXYpnPop/xtVaTcnUl6OARSM+PlE7TM4bjCESY71e 9PX0LDHzYFKbaeQhrIzPPZeEkPC/WmTO//Oe1aKhKF8a6/X6BEevNGTD4OlU0cI8JErX/a r/6cnz5VTkq+rH5voadt+58sBRX1T7Q= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717594589; a=rsa-sha256; cv=none; b=AuUxiFV+Hmf6Ii1mRIvSUNfy36YuLx1yjj+Oc6czh5I4B4CBhqoZao1tpUr23kqYufpOjI vFu2Pvy7Hkzcz40lTIky+DVoBBSXDy+rdOVFhg3YW5WDR9lxdo+YLb/l7b9kpPDpO8OvxK E1g1FYDpm3QeQiH6aTHxsKBpdb1yizU= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4VvT311tfpz1HD9v; Wed, 5 Jun 2024 21:34:37 +0800 (CST) Received: from dggpemm500005.china.huawei.com (unknown [7.185.36.74]) by mail.maildlp.com (Postfix) with ESMTPS id C0F3314011B; Wed, 5 Jun 2024 21:36:24 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 5 Jun 2024 21:36:24 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Alexander Duyck , Andrew Morton , Subject: [PATCH net-next v6 10/15] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Date: Wed, 5 Jun 2024 21:33:00 +0800 Message-ID: <20240605133306.11272-11-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240605133306.11272-1-linyunsheng@huawei.com> References: <20240605133306.11272-1-linyunsheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500005.china.huawei.com (7.185.36.74) X-Rspamd-Queue-Id: 58981A0004 X-Stat-Signature: nt8ght1tn54yeouk1t8gr1xeyt79u1nw X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1717594588-281779 X-HE-Meta: U2FsdGVkX1+w5VoP6/7wh4WSt7mc4GFXDQ6au/kWo7V/rH+PaVLC5i4mJW6deTG9C2pEVKDkVWuQ0NrYrWHBUNHmV7WIYAF7anJ5AE8YEUML6FFjRaP+T3lyGxX0EciErHnJoL9fWD3cX3Sot8ZW9kI1yFKBdwU+ut0toUEw667xdzibwbhOYuovVrCmg3J9auM8wMsWhWm0ajP2M8Ik2lCdcrKsJJPTXcFULOVsTLK9qjxYIM+ru6TxlicJmRB0dp5FLxCaOi9yOBqqm1mBzkk05Gjahs2WDg8QQWfT94SipNTXWK1DLMy2DTaaPANzu/PzBj1veposBZimaSl+2Pg3UI4ZPFYSN0pqiNAuBfoSFzTuDvx1O6GgcqbUmuPDVd1hCUmNEIfS0l4EiixTnJ0bdZC6djDUBeyXZq84INKxTMBoYULskAHpILunyheik031jnN7ozNabT/IdD8yaU47cFc5pYWezPN9oOZ1V3x6wKFAFPTrFR+lMtY4nBIH3I93bDhLntG2qvMOMpi9oQP30s0bISM6vSKha5S+epekEnOl5uiTbU7XqD9hhy8GrZpYoCevX8aIa1sjlK+P45gdzEEE4JCcw/Z/wLUX2esAz5gd0H1pXxVYReWtEHg/2QnbMotsYt5xRzCqVNb1k/Z0M7NiImv6ZBIdcsHQhm2yPXoGBbpE4LdUHvfBF2O5nrxReE9s7JGB6RCDdFHjA9PQNm7VWBnL4JIuofc1DpPpaY9oQrf5XevjR58XZiKnvV9is6luecs+s5H9JvygXAHVrDq53orgu4OMXZHdzmL5tl2FLKIMMfqhrC6HWTFtFcN9hWzXk1LWBCRjCMNoNSiIaBaErKt90I9xIXiLFFknZln+VcfZTNW1qd9SUBFiosKAzCoMMPT8QnrmBAI2XYmlFH3JVRpkZpUjNCDmBw24PyD2ldheEyBle2cqDuYvHeYIUK79QY7I0MVt8Ds QlvVa4/B bqAKjiFApaUGHhzl94FbEldqLlM1TcVVyUwvOgYe0h0SkU6R/yQZXI+/1oqY8KiR6i9Y5w9pVXUwIG6I16Tj1c7SLSRjxsId+Xw4blT/qI3Z8LbP2QQ/zzBZcqzCTD4TNQM/CVh8hfZznaTuHzQOeI2JdC7Rv5s/I89oDuMbXjVU2OJH5PWoHXBrsv7zKylSYqJBsT23NvP7w8XpxKJzW97TukoNgcOIBK/R7QpuXSbXSeBfkUWAgJMUNU0UAL68PV/ivWJcoLSm0KLhZ65MbAnfvWMjwRH3+vL0y 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 casue 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 b5ad6e9d316d..525b577b03a9 100644 --- a/mm/page_frag_cache.c +++ b/mm/page_frag_cache.c @@ -65,11 +65,11 @@ static struct page *__page_frag_cache_refill(struct page_frag_cache *nc, 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 NULL;