From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79038366DD3 for ; Mon, 22 Jun 2026 10:01:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782122521; cv=none; b=LXo1Do3mrKOCQ0Gcvqv157BO8xY5PFnO9MKS5lhq2hA8kR0picJ7zN7MZLz1X4aRgEce+tNBtaPF6pjlqfRYgqpVpKt70stavIr8+eA/NPI9VkRSEfnryg0qbQJJsk9ojZAPKnGwmYOoS1SyDai1QPEYGJb7DqgJeq8QX98gQCo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782122521; c=relaxed/simple; bh=zbY9/RiRicFkbP/jenbYraBRONOcJZ2kJaWAeqyJJ38=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=PQhvuJ4A4mcsq8Lu1YNwEfbCuVP9z9DurN3yjNi+5L8ja7JOJLDKEF0BtG4wCQr6CSTDr/5FiyWQD++AQ2/jIuml+SEmtf/74RyhSG4KOZwoB1TmVDAbyxEPueoOB4Rp77rLHMZheEjQdLDiRzaaY8AzA1yZ4E/JEJfgo1AwQVg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=i56uF1Uy; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="i56uF1Uy" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-4923411f041so33916155e9.2 for ; Mon, 22 Jun 2026 03:01:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782122518; x=1782727318; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=MsOFaY28yUvKoPbHZxbuYx2M7iMWmO856P7+eBzy0OY=; b=i56uF1Uy2a5UnR10D6ESz89C54n87a1iu4N04AEINyndohNa+H3xNai1WPAEGOPpEh ZJ8Aa2VGqyTLKfth6dMyUo+CJ26Kz4B8v1yod/2HgfWQZAPolABjRrKP+s2LXVe5+Ku6 74yHsqASmj4NgocXnlARSOVzDboBC2yJTIGZKpNwnVxXbm/bNIumhnP8RlLLyjtCs8m7 NCMcG75x3qdqwuwcjdhnKViK7FEZ7q17UhVpy1snD9q34t4LoGJJf5ds63UPCSlEbZxU fLaWcTK5WanSBZir9RRooxZCZgtr3m4MTA0ykgWy4OJWIgyh7LJJpExIefTLKxFGYv+t Ah9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782122518; x=1782727318; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MsOFaY28yUvKoPbHZxbuYx2M7iMWmO856P7+eBzy0OY=; b=atvyt7cspruELB1wJD14e3rQxCBSvsCDY0WOkqwR08EU5WRYEpa7H04kHBOwJwYVSh k1F5H7QcDhYWHZaMPoW6EaVCYoNS1IJETc5NCymOf9xqmC8qxRNcKlmGJcg7DEAVon5a 3cKa08CKlwTtNVcRk2XxNTo0o4RvDMU2ihUFJfw+/Z6mOo5keXvEbVO3OZGxZxqU/Zm7 Dc/X5X481pJD1mEXAUM6fKyknGBaYjukSQE8cZ+WX0jkCzNYxtoy2MNJ+YRks18sQA08 D7hsm8eLj7g9pw8TJIWw7uhpSoRAioRxO90W17kZPliuvJ93GiIbGGkI8vcoWW50R8fx l9gA== X-Forwarded-Encrypted: i=1; AFNElJ95uIEJN/2zd2YFMtsXooEiyXBkbH03FBt68yX95ikvmxuTT/7Ddkjuepm9xqATYl6Q8CNBarcZjImeCUw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6T5d9Ehr5OtwaSghlnLmWNuAeyaXV6mi+hT3QayO8+2I6aM9b 8ZvEnGt1EgYUTDDdq6s/B0a3lDVH8BZA3xxhYzi0nn+2+24l0Wsg74ww1PaGJ9BHq+Nc/IQ5R7C oIec2HGowOrEfZQ== X-Received: from wmjk5.prod.google.com ([2002:a7b:c305:0:b0:490:dc44:9b3d]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:c088:b0:490:4ee0:82ff with SMTP id 5b1f17b1804b1-4923f58896emr216559755e9.27.1782122517852; Mon, 22 Jun 2026 03:01:57 -0700 (PDT) Date: Mon, 22 Jun 2026 10:01:39 +0000 In-Reply-To: <20260622-alloc-trylock-v2-0-31f31367d420@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260622-alloc-trylock-v2-0-31f31367d420@google.com> X-Mailer: b4 0.15.2 Message-ID: <20260622-alloc-trylock-v2-12-31f31367d420@google.com> Subject: [PATCH v2 12/13] mm: Move __alloc_pages() to mm/internal.h From: Brendan Jackman To: Andrew Morton , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Johannes Weiner , Zi Yan , Muchun Song , Oscar Salvador , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Mike Rapoport , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , Hao Li , Christoph Lameter , David Rientjes , Roman Gushchin , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: "Harry Yoo (Oracle)" , Gregory Price , Johannes Weiner , Alexei Starovoitov , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, Brendan Jackman Content-Type: text/plain; charset="utf-8" It's no longer used outside of mm/. Since this means __alloc_pages_noprof() is no longer visible from gfp.h, this also means moving the definition of alloc_pages_node_noprof into the .c file. Signed-off-by: Brendan Jackman --- Documentation/admin-guide/cgroup-v1/cpusets.rst | 2 +- Documentation/admin-guide/mm/transhuge.rst | 2 +- include/linux/gfp.h | 16 +--------------- mm/internal.h | 4 ++++ mm/page_alloc.c | 11 +++++++++++ 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Documentation/admin-guide/cgroup-v1/cpusets.rst b/Documentation/admin-guide/cgroup-v1/cpusets.rst index c7909e5ac1361..52a213aff04e5 100644 --- a/Documentation/admin-guide/cgroup-v1/cpusets.rst +++ b/Documentation/admin-guide/cgroup-v1/cpusets.rst @@ -284,7 +284,7 @@ take action. ==> Unless this feature is enabled by writing "1" to the special file /dev/cpuset/memory_pressure_enabled, the hook in the rebalance - code of __alloc_pages() for this metric reduces to simply noticing + code of the page allocator for this metric reduces to simply noticing that the cpuset_memory_pressure_enabled flag is zero. So only systems that enable this feature will compute the metric. diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst index 23f8d13c2629d..16f37135ed80d 100644 --- a/Documentation/admin-guide/mm/transhuge.rst +++ b/Documentation/admin-guide/mm/transhuge.rst @@ -761,7 +761,7 @@ compact_fail but failed. It is possible to establish how long the stalls were using the function -tracer to record how long was spent in __alloc_pages() and +tracer to record how long was spent in the page allocator and using the mm_page_alloc tracepoint to identify which allocations were for huge pages. diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 7edcc2e0be9ce..9656a62138917 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -226,10 +226,6 @@ static inline void arch_free_page(struct page *page, int order) { } static inline void arch_alloc_page(struct page *page, int order) { } #endif -struct page *__alloc_pages_noprof(gfp_t gfp, unsigned int order, int preferred_nid, - nodemask_t *nodemask); -#define __alloc_pages(...) alloc_hooks(__alloc_pages_noprof(__VA_ARGS__)) - struct folio *__folio_alloc_noprof(gfp_t gfp, unsigned int order, int preferred_nid, nodemask_t *nodemask); #define __folio_alloc(...) alloc_hooks(__folio_alloc_noprof(__VA_ARGS__)) @@ -294,17 +290,7 @@ struct folio *__folio_alloc_node_noprof(gfp_t gfp, unsigned int order, int nid) * prefer the current CPU's closest node. Otherwise node must be valid and * online. */ -static inline struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, - unsigned int order) -{ - if (nid == NUMA_NO_NODE) - nid = numa_mem_id(); - - VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); - warn_if_node_offline(nid, gfp_mask); - - return __alloc_pages_noprof(gfp_mask, order, nid, NULL); -} +struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order); #define alloc_pages_node(...) alloc_hooks(alloc_pages_node_noprof(__VA_ARGS__)) diff --git a/mm/internal.h b/mm/internal.h index 6bc89ec62e527..0847b55bfc147 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -1955,4 +1955,8 @@ static inline int get_sysctl_max_map_count(void) bool may_expand_vm(struct mm_struct *mm, const vma_flags_t *vma_flags, unsigned long npages); +struct page *__alloc_pages_noprof(gfp_t gfp, unsigned int order, int preferred_nid, + nodemask_t *nodemask); +#define __alloc_pages(...) alloc_hooks(__alloc_pages_noprof(__VA_ARGS__)) + #endif /* __MM_INTERNAL_H */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 074e007bf1bc3..d99e4ea8307ea 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5410,6 +5410,17 @@ struct page *__alloc_pages_noprof(gfp_t gfp, unsigned int order, } EXPORT_SYMBOL(__alloc_pages_noprof); +struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order) +{ + if (nid == NUMA_NO_NODE) + nid = numa_mem_id(); + + VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); + warn_if_node_offline(nid, gfp_mask); + + return __alloc_pages_noprof(gfp_mask, order, nid, NULL); +} + struct folio *__folio_alloc_noprof(gfp_t gfp, unsigned int order, int preferred_nid, nodemask_t *nodemask) { -- 2.54.0