From patchwork Mon Jun 17 13:14:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 13700610 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 75C2EC2BA15 for ; Mon, 17 Jun 2024 13:17:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ADDDA6B01AE; Mon, 17 Jun 2024 09:17:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A8BA96B01B3; Mon, 17 Jun 2024 09:17:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 951456B01F0; Mon, 17 Jun 2024 09:17:46 -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 76A786B01AE for ; Mon, 17 Jun 2024 09:17:46 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 33EB41C1E32 for ; Mon, 17 Jun 2024 13:17:46 +0000 (UTC) X-FDA: 82240432932.19.970EBA2 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf06.hostedemail.com (Postfix) with ESMTP id D7C33180019 for ; Mon, 17 Jun 2024 13:17:43 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.188 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=1718630258; 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=Mo2a0Dggi179f1LZrraRhqraSPjEgRlXf6jEO1rYC38+Mys3qpgqMLVz4LEWML/2ve5Hfh +mDx1ZBOT7OzPposbsOlHnTrTioak1z1MMswVwwDnlKBoALeccpfJFe0KKpHcw29kFb/hm yUlg5xKA6BwX+61hWUsLLjOhsdTa6V4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718630258; a=rsa-sha256; cv=none; b=QOlntkC9iNi09KHo4DganAwk3lgTWv0pm8GchvUDdloo8HwbN1iOvQ2P1x0WcsNpgZbjNj lzdF5ZwHWSJHEKQJXBHG/Og1+uY9WK4YeXeK84Hm145lKlpkTDKraKp/dHhyV3/F1K6vv7 MVpQb3UP/lCro9qMLhxdtnlny3L8G2k= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.188 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.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4W2r0J6db9znW17; Mon, 17 Jun 2024 21:12:48 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 83FA51402CA; Mon, 17 Jun 2024 21:17:40 +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; Mon, 17 Jun 2024 21:17:40 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Alexander Duyck , Andrew Morton , Subject: [PATCH net-next v8 08/13] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Date: Mon, 17 Jun 2024 21:14:07 +0800 Message-ID: <20240617131413.25189-9-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240617131413.25189-1-linyunsheng@huawei.com> References: <20240617131413.25189-1-linyunsheng@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] 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: D7C33180019 X-Stat-Signature: juo95gks7xir14nru1b6hq6tpzz5uwbh X-HE-Tag: 1718630263-334716 X-HE-Meta: U2FsdGVkX1/j9lq3I2mIJWm8ETNtpRPh/2wGP6id0oKS0eR46eufJ0Ks85ftpeJA7d6jRh2XWzb2uB/mGw16OAr5SETQn5QgDZhLTXiIvmHlULxfRSTQebpGMjiYbHBEFvkeIAyevna/R/bW/i+ijFqq7BblB/BCHHOlpPXJNnmLr02WhJDMCchlSKH0Bty9jeoZIjKUVmLJEkubaS0/N8AItOJ/Cb+cxtsLi5ada7qJvI0umuqw3/ABw/PkOoE6tQJBJUnMQhvdHaUbGSljK+X8Jf1v3xQgu/agDZ7cA6L3d0GRDshfptQC8kzA/23tR7oMngZB6vmNodbgBSxV82KLvvlQtmUNmV4a7G9lfnNnKBZyJ4dL//lHHBjuRNnV36TJ1eiSmjJaNatsVn9U9jt6kP+p329Z3CVcr2RssmSbdH1328JEpBBxFKTKn7M7AA9/wVoe1F+CYmeE7FARwp/doKvJf/0WwIQZRvrFV5Cl2RYYZz2PUDqIwHEgooT3M0IHn+tndIbmZj1/EMqVdp+iDKJpuGfRWSQ+kfkTjalbCOPcT1bUtXviT6cr9ARba6tedDS2ougMtIJbHlw7MIu76bjCk1DJB2r6aGLUaslJiCm5WTgT4LN+EVrUi9Dv4rR7La0PndM/JMTDsjjyzpxHx3TklB0SiFnWq68/B5Xc4LNm0HPD3uAT22DYgooD8OsFun3RNt014xso2YDKNdF+LG/3PTtu7rhFAu8+W8LnbCUka9RrtpkIavDXoTMskBBIX2JRDUMPp86Kb46MXouFyXqMEOt9NhDjervqmVaW5xX77eIiFyt6u0izmoIVtCH/JrqYe/21oDZJVJC8rCE2p1bLo+Ha5JIzDdjLPkbaN8oFC1Jfms5QnsRd3imy31HrKoJcBiYDGX0qETORBCi6nhkZlfqarSskdqH2s135u4ubdODbU2szfUUlYjI2UaA+a0APkkJMSkxIJNo UmSrT082 WBn4yXscUlNX4RThorTdUspOM+fvD/sxSp/W06XHQwt0VqTaETKP2OlyRzBvB9kX3KYAKmYwPScCCip8TyEuvThlWDn1wY8JrFJzNlp5Yg7AqfgQ7teoL1YmYpz2KLIpkywnrRWKCPSwvURxHEynovrnH4LGgK9U8pAiEo9FRIutnIQJAIsZ6PDCAY6bn7vgVEhClWa3laSd8Y8qA/mRnVcCzQkKlOqTasjsKezlCtE6JSNPJ/qD5MI8nrPPYc4qLrcU2IB8c79UnaexfBPOR1PToMoEbTfzED38bRK/BAF5u5/M1WgEHXJssuiHdjffaPXuC5GgWC1foOJ1o+sua52pbeYzlV5Lyy1pECPfQzOESR5IT5p0OfHW4REiRC3ec4DV4Voz9/sYflg24ePMbWVyR/4ZjNcHtFjGEIBNOJY1bQm3JMTR4X3MW26gwzBFkzVb3 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;