From patchwork Tue Jun 25 13:52:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 13711197 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 19E83C3064D for ; Tue, 25 Jun 2024 13:55:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 884B16B02EA; Tue, 25 Jun 2024 09:55:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 836F26B02EB; Tue, 25 Jun 2024 09:55:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B02F6B02EC; Tue, 25 Jun 2024 09:55:46 -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 43F776B02EA for ; Tue, 25 Jun 2024 09:55:46 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 06ED81A1A22 for ; Tue, 25 Jun 2024 13:55:46 +0000 (UTC) X-FDA: 82269559092.13.85E3F11 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf21.hostedemail.com (Postfix) with ESMTP id CDCD01C0012 for ; Tue, 25 Jun 2024 13:55:43 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719323732; a=rsa-sha256; cv=none; b=BDdbtflSB8eQZ9EiZHBdlCc7MJWsZ5b/Q+dWW5kS/X+IzXglVwy3spLfUjWbcoo3w7Ebr9 cx1g6YMX5uxDlfg62zy9Bu6wwNC21J1q0ZdcFQQs4AdvB72vkhtlD5Kc102HPaMNrY0kfS Up1P6qO/6VtEPAnfyqBF55PTjAA/Exo= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.188 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=1719323732; 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=g4kiWZSmNfaCYFbfNlnbprCMaAtHBQlML04yuT/Iszk=; b=DOQTX4CKPMC3hZIoyeKGU6Sds6GmRNB86UXpGOcfOt4IFtTitzcuIroK6HUzN/WLRYQpfk 3KS0bJ/dXaabb7/wCg26ftc01YcuU8KSDwgPTMHExs72VU4hp9vKiS2O4RMmhnuEuR2No6 EoimL1sV1RCnoHX5SFaznPNTf0CcwsM= Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4W7mXH3VfZzdd8l; Tue, 25 Jun 2024 21:54:07 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 0103014022E; Tue, 25 Jun 2024 21:55:41 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) 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; Tue, 25 Jun 2024 21:55:40 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Alexander Duyck , Andrew Morton , Subject: [PATCH net-next v9 08/13] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Date: Tue, 25 Jun 2024 21:52:11 +0800 Message-ID: <20240625135216.47007-9-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240625135216.47007-1-linyunsheng@huawei.com> References: <20240625135216.47007-1-linyunsheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemf200006.china.huawei.com (7.185.36.61) X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: CDCD01C0012 X-Stat-Signature: jxaj7sm6x9ax8q9ni3b1cmm8p9ukh91n X-Rspam-User: X-HE-Tag: 1719323743-935682 X-HE-Meta: U2FsdGVkX19RQWP1SKOnOHLJI5qT2W0kpOODqcmXebD2t7npHY1O0ecZSVJnnrdKC8oIMCS4J8hBEN71NSXW+phg7d2Adqj7D0WXts8WR7oMaKGZHGsodLlq7ccA5xOfU7ddo/s6Is0bUBzlZUA2AgkbLCcQZD/3ISDyGPTtbkySxikcZLmq0qbAHvFVjYXQ/1ERC3AF66HENbStWkFIeqEuPhsYLbiOI1wQ9nKXRlxb/Ywg7Mz1ewrzNGWhbXwMgV0sw4S+PP6LvjSNsSNkoK81MVJiRCsrOpTs3lbqRxFKAvQA5ZKpnMHBlzZgCSBvAYga65M6vIJksTawEklhhSaLAqQSleHJ14V0169cMnquQdhoUzJlTZ+m4W5HXXN4xqXS6uy8NbvyK8NHtu3TQwY3N8VDMHS+tfs1yzogiWS7dvT9AcxtTs60xyChZO1yNuU3JAt93XZTpf6Y4Q+WKmxXVMD4w1AfgDr4E+FlN5HHkO5f/S+aqMSnabc7M3zC6J6cf+u8+0gaMaj3SmzT0CVUa1FlH9CRKaTLIBqs0kegJ+HDQp04PaJuJXjt2FYQXdWwP/p7CAlQxqEwjvWgW46S6jLTjYXH0AYQ0uC8ccK4rQ6xLsALA/y6hW8ptYH7D7luPpJsJJf5J87VpnPvh+KSygxvaGw5KwSEjb/W4GEdrXo4AYIb5S3OvK+tVHt88gGmYIfF0DQMeogI0c8SiNK+GSX4YQXWXRSSQwB2Hdzyg5tUB2MqrhwSr0KNwpyhojQAaruHlXEQv7XvG+FWJoDkvwDPvu636Qs0Y/lBk1ujYXRcnIAwePdnak6LRrkhMJKrgVnxOOQl38s63/ZoZezvKuPSclBAkhdV4VMpg09QJRzSQpIT99q95ZX487xqEf6Phfx9nlC0zWSATNyVrhr4xiFnjBPWwuxS+v2zcpq2PAgTodyCg2QcYZJ1R9juC/7+0+M881SV1iCS6QJ +ISAMhMB CnI0IeN6rLaLcI2XO9cufxYCqRZzRqkW2NUoXADfaMrXQRPMITJQDn+9fC1uQfnWddQGpe4KiEn9O3GHbeAm8mO/PvJCMq1EcWat2YnwxU0nFj9bMwP7XLASH9ws0lGQYKOf3HEwt12Op0R9i53JaD8KtszxXQzLdwITwEdLd300f1e4SktPysE1dw6pepZFEUm6/WK+IFhcEeNWxz65gAI5H2lOnNQ1JaPZR8Mb7C28r6EnMfH2gg23t1UXZxxOfturCR0NYca7MPgsov8r1S7Z5YXJmd1NKwIwq 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 4fd421d4f22c..58facd2b59f7 100644 --- a/mm/page_frag_cache.c +++ b/mm/page_frag_cache.c @@ -62,11 +62,11 @@ static struct page *__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 NULL;