From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f74.google.com (mail-wm1-f74.google.com [209.85.128.74]) (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 BCB263D564A for ; Fri, 3 Jul 2026 12:32:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783081963; cv=none; b=mcjuT88hBfMU9ZNTf0CaUzTPrUbIWuA/8GK/T+Jh0zcwX/sb6bPbGNfbh2rUgtZm02YvmuVCttToJM9sCluHYtgPPiq8jvesoRafb2j2k6JHE5VlJPrKGDmBuiQz/NO4fKoUx0sYQ6lq8r6DOulveMZMgSgHzjQ7vEvHirk9DnA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783081963; c=relaxed/simple; bh=WYRAiNqfuhhWu100CnX8SSdMrI632TiSlNqqVOt1euE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=tNRraV5rk1Z3kqMrszBqmKdAlLlBlME6UlbhOtezJNr4zk3Js7nP/qJmUxdpbgRucBPnk0bBN/0uXs4poy8hCZFDn2IDL7W7jxfInxWUuPeG8PY7hsn8CRgJyQZnrYPEcSM1kDwp7RWLBLVB8dEbOJLyCrms1wsi+AFcR+qAPfg= 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=cz336080; arc=none smtp.client-ip=209.85.128.74 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="cz336080" Received: by mail-wm1-f74.google.com with SMTP id 5b1f17b1804b1-493bdf90adaso4738425e9.2 for ; Fri, 03 Jul 2026 05:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783081957; x=1783686757; 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=1tnwOMpS/BIg5QL0SfFSSGMbCh9S3UbjX7wTwpmbKGs=; b=cz336080RIz69VGJUuhIRCVoQBjOsnoN5EZuCsb5NWqOuGUwHCDigijxrkmfSh4plo xsnWWcNaUNqH8loXSu4jTbLQv/4f+GDX6Ue34sr9wViSUAfYxmLJdlZFzaP1tNF2E65d 1IctKD2g+lH/To3W4IsJO1ApySKA3pSYvSvOsCdsJVvEfLPRJCzMwd/mbYJGhNqF8DZi Kd+ONYEHqiCUP0bBpF9LhZqBF6K94aUKvWO68k8Z4SYZybWdjEFAzPJliOoiVHE/tNUw QLReFkUmSb8zAzN1gi8v51iU/hmgFkN3CZlPUjBKbyKb2MD23YzVYZemDlyVH2BrCxcp VHUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783081958; x=1783686758; 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=1tnwOMpS/BIg5QL0SfFSSGMbCh9S3UbjX7wTwpmbKGs=; b=cV1hS3U1xc4tNJbFGm8vxi4sklRcqSuCbVSCCZEuahVPk/s3spxbx1Bq6s047aXH0B GhUouU6OZ8rXlZke2W/7qWQZvlcnmJY1pNVIaDxi/PWICKzsj4lLTdUsjwhuG0N6F5KC s1g0GnGfzZVQwi0c87VyPCpjVIPpNwgdI1/lY9fSlS/AWRNdFxDJ1tYrJiylc0fzVD+L ynErhSaxw4V+FEwIJPlFLLl9oSJAAYw3Ruj+kS30fbG5Rxz9Vtbe8dtQATB1a6+0h74w feHZsp7Q6BDC6MD8FVwW9pDeZ/kJ7OMRgF2bCmKNUaI98nxUr8m5zZoqRoXflDPL5aXP CqVg== X-Forwarded-Encrypted: i=1; AFNElJ9JU71MU2JG+wJ1PafiItVQ9lwuAyvwvj+E1uO6g183lWYuDXZliaEnuXiIme49b2fQSEI/vKQ+/5xEK38=@vger.kernel.org X-Gm-Message-State: AOJu0Ywa7zCONvLTkUP16NEBqU3lfFLvYfoXqo04gPVacPbqjlehguWv XiPvQPplFO5mrD83CKg0FXiOitVFSwcw208oSeJDWopqa75jD9td+63ibbtmQ5Bsjr2Of1jhUsy ufCUSNaw5he3fdA== X-Received: from wrhm3.prod.google.com ([2002:a05:6000:1803:b0:46d:6fd3:e5e9]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:34c8:b0:493:c2e3:b2c1 with SMTP id 5b1f17b1804b1-493c3df75ebmr139076715e9.33.1783081957147; Fri, 03 Jul 2026 05:32:37 -0700 (PDT) Date: Fri, 03 Jul 2026 12:31:54 +0000 In-Reply-To: <20260703-alloc-trylock-v5-0-c87b714e19d3@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260703-alloc-trylock-v5-0-c87b714e19d3@google.com> X-Mailer: b4 0.15.2 Message-ID: <20260703-alloc-trylock-v5-14-c87b714e19d3@google.com> Subject: [PATCH v5 14/18] mm: Move __alloc_pages() to mm/page_alloc.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 , Hao Ge , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, derkling@google.com, reijiw@google.com, Brendan Jackman , Yosry Ahmed 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. Also remove references to this API from the documentation tree - referring to the specific function name was already questionable but now the function is not even public it definitely seems wrong. Reviewed-by: Vlastimil Babka (SUSE) 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/page_alloc.c | 13 ++++++++++++- mm/page_alloc.h | 4 ++++ 5 files changed, 19 insertions(+), 18 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 3bf55a5f9143e..4d57e9c0bf204 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -204,10 +204,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__)) @@ -272,17 +268,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/page_alloc.c b/mm/page_alloc.c index c2839959d7908..f68b2b138a2e8 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5431,7 +5431,18 @@ struct page *__alloc_pages_noprof(gfp_t gfp, unsigned int order, set_page_refcounted(page); return page; } -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); +} +EXPORT_SYMBOL(alloc_pages_node_noprof); struct folio *__folio_alloc_noprof(gfp_t gfp, unsigned int order, int preferred_nid, nodemask_t *nodemask) diff --git a/mm/page_alloc.h b/mm/page_alloc.h index 2d60551b4453f..aa0c1481f7ca3 100644 --- a/mm/page_alloc.h +++ b/mm/page_alloc.h @@ -244,6 +244,10 @@ struct page *alloc_frozen_pages_nolock_noprof(gfp_t gfp_flags, int nid, unsigned alloc_hooks(alloc_frozen_pages_nolock_noprof(__VA_ARGS__)) void free_frozen_pages_nolock(struct page *page, unsigned int order); +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__)) + extern void zone_pcp_reset(struct zone *zone); extern void zone_pcp_disable(struct zone *zone); extern void zone_pcp_enable(struct zone *zone); -- 2.54.0