From patchwork Tue Oct 1 07:58:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunsheng Lin X-Patchwork-Id: 13895551 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 623E2E7716D for ; Thu, 5 Dec 2024 15:22:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 75EE76B00C2; Thu, 5 Dec 2024 10:19:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FC926B00E5; Thu, 5 Dec 2024 10:19:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFCD86B00D7; Thu, 5 Dec 2024 10:19:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 30745280036 for ; Tue, 1 Oct 2024 03:59:57 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id A881C1C6B34 for ; Tue, 1 Oct 2024 07:59:56 +0000 (UTC) X-FDA: 82624284792.26.57178D2 Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by imf06.hostedemail.com (Postfix) with ESMTP id C1F37180015 for ; Tue, 1 Oct 2024 07:59:54 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=SqSY5TEN; spf=pass (imf06.hostedemail.com: domain of yunshenglin0825@gmail.com designates 209.85.215.195 as permitted sender) smtp.mailfrom=yunshenglin0825@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727769467; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ADg4SjL/TdWbtGYAOROzU48mvQIzqBv73gL/8ReCbpM=; b=7lk0l96581wpRw1A6sEvRPfQPM68bHYgah6vB2l6346KGPloPrf0DEXPlFQRKQzbIVD/eT kc4F2m5X+B+8al6ogt3DpTJ+l7oEMGLzDG+zIGPamG/Rq//RJ8YUJt5aR5C2T4FzJr2d40 2EJRrW+6v/TtxexSKuspki7lHEJE/58= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727769467; a=rsa-sha256; cv=none; b=FWlSrFAfEQDAmLndgvhPv2ebbW/qoaGcUPeX6LimUbGy2P5O1Qh/kONFva00d6CfkBUk3U 8peZApj1+wdtsZv1XeinY/Ph72bbrtcsWdIP3n8qwLQ9byElZCw0gQNq7fX1sWqWfCdxH9 KeIxhMJJ7NZMmNBmM4kcdD6gB28K4P8= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=SqSY5TEN; spf=pass (imf06.hostedemail.com: domain of yunshenglin0825@gmail.com designates 209.85.215.195 as permitted sender) smtp.mailfrom=yunshenglin0825@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pg1-f195.google.com with SMTP id 41be03b00d2f7-7d916b6a73aso3330166a12.1 for ; Tue, 01 Oct 2024 00:59:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727769593; x=1728374393; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ADg4SjL/TdWbtGYAOROzU48mvQIzqBv73gL/8ReCbpM=; b=SqSY5TENojGeHT5YRVnvMyjxQ+D1QHX3XbGf+I2jfwENVj1k7AbRWK/Nuh1oyqnMXz 3HCbroxbulutJDNV6v3IvzsFFtu28j3bRHvhSKRWg/YvOrHcvmivYQ/OewCcy1v5hdUY Rq6FG5Zby0RFdxUKS4MMi2aaIvmnH34s9M1gydv+VIMzdmw2YHBN1saS2Wazxi6WnxiH zTDZlqqY6UN/n0CZdtyClHj19c1C+pgSH8QYM2Aoi9Xb/maDBV6/1gba9zn927m+0lYB yclyl+RP/K5Obzl2LMNVv/rGBsMqUoKEgf/ySHiGFfVNq9sfFgS2cJESqZoX1BEL62Pz qFVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727769593; x=1728374393; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ADg4SjL/TdWbtGYAOROzU48mvQIzqBv73gL/8ReCbpM=; b=EYO44+2T4CBpxTc9mfhU6lRoDldLHKWYVv3oRkiX91hhBBYMps9xcFR6XDMzXvgDqm U6w08KeTdXiUC+TthnW5zeyPUbddvVGP8+8KWh4BFhfVwB3/5dTfBpe24w3qaX83FmdB VT1aFv8X4mxLFqhUCiN9PdPskorNNNFFr+PGNMRHPyH2cguz6ZyZMXyX1aLtIBwFwZDb x2BwJPdvbwLSyjMKDKALxkD6X4kiDL456f/Il7iSHPI6tdY7BCzNmqGzoeXygBsi0nC2 KMdN1EUzXPBTRI5ZQ/B7Tuu5WpeMt78BXHevghCX8VcE5xoJHHEpqNGpjAlQxfppCxmq 7CXg== X-Forwarded-Encrypted: i=1; AJvYcCUSJ7KojYnr1Z/TOuOJW4i3pcTYja9SHxwbzAg0sLKtB7Sd7p0aMrweBDs69RYbxHa6fIdMJYArLw==@kvack.org X-Gm-Message-State: AOJu0Yx+UXjsK3zbgrCK0w+ql9whM+YzTVVCpjw7azzCuid6fNBqxTbm gn64nMHyPKu/BTXuDhDrd6Ya27kEMidxRb5052uzVpXgsxyEnxNC X-Google-Smtp-Source: AGHT+IEMEMikIwAsGNCUaKklqicU3DUMXbKshUu12qfRtEdI3bF5DTyiGRaQfG0r7h/YT39HL2cwqg== X-Received: by 2002:a05:6a20:cf84:b0:1cf:49a6:9933 with SMTP id adf61e73a8af0-1d4fa6c2f99mr18322559637.20.1727769593548; Tue, 01 Oct 2024 00:59:53 -0700 (PDT) Received: from yunshenglin-MS-7549.. ([2409:8a55:301b:e120:88bd:a0fb:c6d6:c4a2]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e06e16d6d2sm13168168a91.2.2024.10.01.00.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Oct 2024 00:59:53 -0700 (PDT) From: Yunsheng Lin X-Google-Original-From: Yunsheng Lin To: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Yunsheng Lin , Alexander Duyck , Andrew Morton , linux-mm@kvack.org Subject: [PATCH net-next v19 08/14] mm: page_frag: use __alloc_pages() to replace alloc_pages_node() Date: Tue, 1 Oct 2024 15:58:51 +0800 Message-Id: <20241001075858.48936-9-linyunsheng@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241001075858.48936-1-linyunsheng@huawei.com> References: <20241001075858.48936-1-linyunsheng@huawei.com> MIME-Version: 1.0 X-Stat-Signature: 69i58c5ob1u7whcwsom96zwbkx7tin3b X-Rspamd-Queue-Id: C1F37180015 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1727769594-653129 X-HE-Meta: U2FsdGVkX1/PYzkLM9xQhtqxkvbYzbVVLz0JRD1i7QyZ1QBMPy5xBzNCXIkIoYB9Yh0+mBzw1EEBqUGZLYgrDokZD9qOrnAnOtCelqO4jrnlZP0xkWy8gAHCAS4go4R2Yx1winI/VzmLlLpgcVxQZv2us2wu7P5kAmqULRYJgp/lPxIVwJssfpGOThqa8EOMBTahBJvp8Jj3f5W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kAmEOZC14IvJnhJwqin3VeRVXGQKoy4eT+rpzBPhVCNuyJMEYU/hg+o7xSeHh3WP8Id1rAnJZpdI5QCbQjbvTildi0LteiTZyMy57dtR8en6YlycdOixbmLPW9sbtg0H7Zr9jpTgoHdXMo8KKbHKy/P/5AcM+Ze3bGG4bnFAKUGz/ySavp642LLn0XLpguqR7uxVFCQdW+fgAPRcXmgp3GB9H3z2W9hZ4GQhCaRuA4llt+GMf1orT/lCpqsQDIHIjNrs8b19LzTbfhVFUPQIh4Xh01zuYSRcTTkhzLeMtQe4/In9s4S17zP 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: It seems there is about 24Bytes binary size increase for __page_frag_cache_refill() after refactoring 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 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 6f6e47bbdc8d..a5448b44068a 100644 --- a/mm/page_frag_cache.c +++ b/mm/page_frag_cache.c @@ -61,11 +61,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); order = 0; }