Thread (17 messages) 17 messages, 5 authors, 4d ago

Re: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header

From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Date: 2026-07-20 18:06:28
Also in: linux-fsdevel, linux-iommu, linux-mm, linux-nfs, lkml, loongarch

On 7/16/26 16:30, Brendan Jackman wrote:
quoted hunk ↗ jump to hunk
+++ b/mm/mempolicy.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * mm-internal API for mempolicy.c. Public API lives in
+ * include/linux/mempolicy.h.
+ */
+#ifndef __MM_MEMPOLICY_H
+#define __MM_MEMPOLICY_H
+
+#include <linux/gfp.h>
+#include <linux/mempolicy.h>
+
+#ifdef CONFIG_NUMA
+struct folio *folio_alloc_mpol_noprof(gfp_t gfp, unsigned int order,
+		struct mempolicy *mpol, pgoff_t ilx, int nid);
+#else
+static inline struct folio *folio_alloc_mpol_noprof(gfp_t gfp, unsigned int order,
+		struct mempolicy *mpol, pgoff_t ilx, int nid)
+{
+	return folio_alloc_noprof(gfp, order);
+}
+#endif
+
+#define folio_alloc_mpol(...)			alloc_hooks(folio_alloc_mpol_noprof(__VA_ARGS__))
+
+unsigned long alloc_pages_bulk_mempolicy_noprof(gfp_t gfp,
+				unsigned long nr_pages,
+				struct page **page_array);
+#define  alloc_pages_bulk_mempolicy(...)				\
+	alloc_hooks(alloc_pages_bulk_mempolicy_noprof(__VA_ARGS__))
BTW, seems you forgot to delete this bulk stuff from gfp.h?
quoted hunk ↗ jump to hunk
+
+#endif /* __MM_MEMPOLICY_H */
diff --git a/mm/shmem.c b/mm/shmem.c
index 5071177059a96..69f561332bb93 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -41,6 +41,7 @@
 #include <linux/swapfile.h>
 #include <linux/iversion.h>
 #include <linux/unicode.h>
+#include "mempolicy.h"
 #include "swap.h"
 
 static struct vfsmount *shm_mnt __ro_after_init;
diff --git a/mm/swap_state.c b/mm/swap_state.c
index 5be825911e645..8ccd03c39a407 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -24,6 +24,7 @@
 #include <linux/shmem_fs.h>
 #include <linux/sysctl.h>
 #include "internal.h"
+#include "mempolicy.h"
 #include "swap_table.h"
 #include "swap.h"
 
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help