From patchwork Fri Jun 7 12:38:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 13689834 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 05C46C27C6F for ; Fri, 7 Jun 2024 12:41:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E90086B00AF; Fri, 7 Jun 2024 08:41:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E3F8F6B00B1; Fri, 7 Jun 2024 08:41:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE28D6B00B2; Fri, 7 Jun 2024 08:41:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 9F7B56B00AF for ; Fri, 7 Jun 2024 08:41:41 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 5D4A3A37DE for ; Fri, 7 Jun 2024 12:41:41 +0000 (UTC) X-FDA: 82204054002.02.5F71B66 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf28.hostedemail.com (Postfix) with ESMTP id F3A5FC001C for ; Fri, 7 Jun 2024 12:41:38 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.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=1717764099; 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=ytpSUSdXQSTx1QUBqfE54CwlVUd8fK2vWO74sKZDsPk=; b=H3j5LEmDoEpUWbL8ShJ0JGZzaNYA7HZBc/w1FlXRA5ZJ6OytRJII8g0BVRgpZcZc/5Ld9B YzAdW++kNHIdPGFvRKd/UPNNv/hYATLRvRHEgov5o5iSqnwk6tCDOqxkvWyZvcHzI+1egh GgQ3yj+jfZi8QoQSTPIEFFfKubh/Pf4= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf28.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=1717764099; a=rsa-sha256; cv=none; b=j04UvUxNx04oF3yvZOJAFPq+GLYGtbED4MHxmjscFYQJgJei+JvauMZ6meswGeyXkaWYLI pHrJlt5bS9FxPFefMVCqboGf3Imjche64AbfXlTrQO2xclBDQ7XUSzsRLhdbPaNfPx4iI2 ObDAfSERLD592tv2VCUuIN1Nk4oJHwc= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Vwghc2pprz355Yr; Fri, 7 Jun 2024 20:37:52 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 7116D1400D3; Fri, 7 Jun 2024 20:41:35 +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; Fri, 7 Jun 2024 20:41:35 +0800 From: Yunsheng Lin To: , , CC: , , Yunsheng Lin , Alexander Duyck , Andrew Morton , Subject: [PATCH net-next v7 10/15] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Date: Fri, 7 Jun 2024 20:38:13 +0800 Message-ID: <20240607123819.40694-11-linyunsheng@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240607123819.40694-1-linyunsheng@huawei.com> References: <20240607123819.40694-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 dggpemf200006.china.huawei.com (7.185.36.61) X-Rspamd-Queue-Id: F3A5FC001C X-Stat-Signature: pdyb67bodnpb7i6epmn9nisado4zz1o8 X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1717764098-8180 X-HE-Meta: U2FsdGVkX18qeFNsgeb+MUz4XoK7C4a+wMZ9W7tzYtYHXxlEjD3rpIGJGX3kP0Lp3fBzP55ToqoCoKsnOhi5B+fCHoqn+5yfXgMruYTGOW31KRyeY0kOk59wFMZHjI1bKcjvHZtkT+n3YyYxyf80Ww5JWVHuEk8E0qQ5nzu9HRTonuNjbPOfYVvPme8XJ88MmsWt5aOHnMPL03lWkQ5kzcDRQi5M1W8qeUnO04xIJS5hxcS7alpcdL1mhxb5p0J77IWG1Wo0sV3u0AY+esR9Zb4yKF3lOlfKJYIDz284oOOBUcEAb9uGlTUsEruuHfBFTYEjnm+g4ATDkFhjtfVDoesXFRLTfzAvfHTGq/um/ODVDol5hPt2oS1H+MNdBcQ64P565cWgxBPiaz3Y7XRh0mmodbqt9k1LNVqLVurVV24tTCVgpe997Cl16JOPpA1lkukfG2B7SNY9fyV3wAPAGRVwQV9ApUUpVDQ8DEcjD0GLKaEOqJ/o+bOGXnUS2sbfKVNY5M8OOX34SGlZEo7HB32pIQLEUqcGxlZJ7YWOCe95gWxgTVjKbnQah0pMxMAl6A0VmaHbiYXGzL4TC3SqT0KGfXD+INLMFoqi2npC/vLyoBZJ3Lo/Y1Mt2rfocR8YqeV1sX5JRCf3itx1WDpERyWCV7hym3m7drtB65qxsr5jnD49OdjIe4YGUesxZKvI0RSjJP4HYKO4aXnHri4hL0uhHYzV3c+hI3zE+ybX592zmH2eUY9FXZ9xcXXY3wjrpadVK2q2pp16DQgVxkCCekgr4GbfO2r1AQD0KjuoVDoCn0uI/VN5rEKKoIsc++nt3eksLcQFFKqffntAwta1W/BMI+vQpjmn4u2agpSpYme4Ng5vapZPfqzbjykUY1dcB217QSnjWYOYsIVcn1ew4I03ZwBqw5P1uD0IceMBPPEe7fnPfoIQYDvpavjQGF0R3LhXx8pdrhj2g1YoZwQ l3eiSF6P PzCLJ470mkqD4YmPwMPdRfxjcUVY7ruNAAdF+l3Ed84oDEag7wCXNPFzKNSZDhFwlssQ85mywJacBxlPl2x2RzSwFPGDvjKSbQ1st4PEOTtofxPa6NQsz9zF93wCoFjO8ZHv1LPSWx4QSemLhTrLq8m7sE7BmSdK0QV2HYANZ/uLATBx18fQi4+4RVf0YOmQMUuZlCDElp8/mjD2Jefbrg4WL6zLUZiNar6z7tbjmeExuL5WFpt0SWUQmAVGigUee3TS9Voh5u6o7rYqnnMKnkuK1TkD6qlw6RLC9 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;