From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.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 9C3A9408632 for ; Mon, 29 Jun 2026 13:12:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782738755; cv=none; b=DakFCJ3RcwsYq8NOGzjbKFS1UHn9dE1vFN/Wf1N0WN804iJoJSoa0UzXbzvliu1FYzThJUa8qkuig75h3fyI9+uvBIfEM+9LeuHyGmDufPnc9467dgXOGRZ6sHzP7r3eFzdipc4k5a9D2Crvo2nBWSYVjHspjlS6u5ZHxVlN7ZA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782738755; c=relaxed/simple; bh=v1xANvYQvnmxJHHFjHgpmxFCzUHLSMIlqhWk/CKUQf8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=M0MphbRjhRDzDat3TPpBLbkfM9pvgUWBTCj8kNRZXemPLCsJ9Oyfp6/FPgQXk96W4yeLP2yl7CYRTey9s1w9A1YYNc+PDM/4ivsk4/yyPJqJ8SOKwuAZowA6z7kf7fAJBjsxCB4ZPTGZW2hkQ50008fcnc2oLT1pDsl0xn+Z4t8= 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=VxVlTYo9; arc=none smtp.client-ip=209.85.221.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="VxVlTYo9" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-473f4a48e9aso500697f8f.2 for ; Mon, 29 Jun 2026 06:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1782738753; x=1783343553; 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=LQupKTDZjED0JSNU6dTXI/Jh97qQEoEP5PP1fd9rJgc=; b=VxVlTYo9gSX+lgIesjpenjMvI517aK9+Y74DOLnR3QSaQ51pyXIszM2ZemyuEOnNG8 fVmroy8LEx9lzEBOgBUNmDZ0nVFFPA8Iske3Oho3bGFLbYCpUDGGjbrrFf5RvT+jKT0n kBpYoiGacoQ27JoVlVf5rNUYmRP61M8N1/SQy52clFzfh/2gIfaQvRcVzEcZtJ71qp6X EZsH8kNYZfwKfW3XurGOvdQRLgufNLCRL4aYreFI3RpA6VND2cp+BvnBhAVNAqdQRECS Wb86l4d5EjDamQbphIp/j6ZXOtbI+PTbLntuBR7emQW2gWpbNH5sEif88+ZDUeMVHdig MRWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782738753; x=1783343553; 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=LQupKTDZjED0JSNU6dTXI/Jh97qQEoEP5PP1fd9rJgc=; b=YX7ZFVdregTL4O3qvkW5f7rUWe4ZAZiecajgefT93Kq2PJaTQMycjDjArodMtF24Bx qniURshryjd+ehwnpb8QsKCeu5azsBbnKfz/5hl9TLqIcEGbWZhYI/InaHEHdoW10k7B OkN3wASqGMoFDx4U2GBAOzON0gR3laHzMkRVsQqj7yPmLXvQtuc4f6kDjdy+KiUpWPCM nranNHnHmxWbKGYFqtWa92pDoTgO2yRMOGTdRere5rkpxUFgO5Rr1SXiBnMO0DET630F 6U92tGXgq67lw9g9Um5jkF5cwX7s0FUL9xG4uzDivR6F71Ycm4bfcXlT7jHaeE15ma1H tdOg== X-Forwarded-Encrypted: i=1; AFNElJ+58vBM5ne3IhZFcvQSJH6rBl3Ndv5kbLyeGopca0xNXtUlGUgbqNXMkIQhAx2MNp8aW9h3jA174RAIS48=@vger.kernel.org X-Gm-Message-State: AOJu0YybfFyAyk0nBy25wChhkQV/gSuLYWYBGQ+E2SEVNtzYeXD411O7 oGPv6zZdfiwNoTlxhT5GZyEjo2hDQ4aCglfpodI91VBod7K3NePDn6kxRLwxtzLV6F/fo4NsZtP 8IpwX1VqQKO14zw== X-Received: from wmdv20.prod.google.com ([2002:a05:600c:12d4:b0:493:b21f:6ccc]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:8b03:b0:490:be78:1861 with SMTP id 5b1f17b1804b1-493b718f985mr10806475e9.4.1782738752633; Mon, 29 Jun 2026 06:12:32 -0700 (PDT) Date: Mon, 29 Jun 2026 13:12:02 +0000 In-Reply-To: <20260629-alloc-trylock-v3-0-57bef0eadbc2@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260629-alloc-trylock-v3-0-57bef0eadbc2@google.com> X-Mailer: b4 0.15.2 Message-ID: <20260629-alloc-trylock-v3-13-57bef0eadbc2@google.com> Subject: [PATCH v3 13/16] mm: Remove __alloc_pages_node() 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, Brendan Jackman Content-Type: text/plain; charset="utf-8" There were only a few users, which have been removed. The only advantage of this API over alloc_pages_node() is avoiding a single conditional branch. The disadvantages are: 1. More API surface, more sources of confusion, more maintenance. 2. Worse impact of CPU hotplug bugs: most users of __alloc_pages_node() were using the result of cpu_to_node(); if the CPU gets hotplugged out this will return NUMA_NO_NODE. If one of these paths fails to protect against a concurrent hotplug then page_alloc.c will use NUMA_NO_NODE as an index into NODE_DATA() and cause some horrible memory corruption or other. With alloc_pages_node(), the code might just work fine. Ulterior motive: this frees up the __* variants of the allocator APIs to serve specifically for use as mm-internal API. Reviewed-by: Suren Baghdasaryan Signed-off-by: Brendan Jackman --- include/linux/gfp.h | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 01d6d2591f49e..3bf55a5f9143e 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -256,21 +256,6 @@ static inline void warn_if_node_offline(int this_node, gfp_t gfp_mask) dump_stack(); } -/* - * Allocate pages, preferring the node given as nid. The node must be valid and - * online. For more general interface, see alloc_pages_node(). - */ -static inline struct page * -__alloc_pages_node_noprof(int nid, gfp_t gfp_mask, unsigned int order) -{ - VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); - warn_if_node_offline(nid, gfp_mask); - - return __alloc_pages_noprof(gfp_mask, order, nid, NULL); -} - -#define __alloc_pages_node(...) alloc_hooks(__alloc_pages_node_noprof(__VA_ARGS__)) - static inline struct folio *__folio_alloc_node_noprof(gfp_t gfp, unsigned int order, int nid) { @@ -293,7 +278,10 @@ static inline struct page *alloc_pages_node_noprof(int nid, gfp_t gfp_mask, if (nid == NUMA_NO_NODE) nid = numa_mem_id(); - return __alloc_pages_node_noprof(nid, gfp_mask, order); + VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES); + warn_if_node_offline(nid, gfp_mask); + + return __alloc_pages_noprof(gfp_mask, order, nid, NULL); } #define alloc_pages_node(...) alloc_hooks(alloc_pages_node_noprof(__VA_ARGS__)) -- 2.54.0