diff mbox series

[4/3] mm: drop node from alloc_pages_vma

Message ID YaSnlv4QpryEpesG@dhcp22.suse.cz (mailing list archive)
State New
Headers show
Series mm: add new syscall set_mempolicy_home_node | expand

Commit Message

Michal Hocko Nov. 29, 2021, 10:12 a.m. UTC
alloc_pages_vma is meant to allocate a page with a vma specific memory
policy. The initial node parameter is always a local node so it is
pointless to waste a function argument for this. Drop the parameter.

Signed-off-by: Michal Hocko <mhocko@suse.com>
diff mbox series


diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index b976c4177299..2ffca4f65687 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -598,9 +598,9 @@  struct page *alloc_pages(gfp_t gfp, unsigned int order);
 struct folio *folio_alloc(gfp_t gfp, unsigned order);
 extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order,
 			struct vm_area_struct *vma, unsigned long addr,
-			int node, bool hugepage);
+			bool hugepage);
 #define alloc_hugepage_vma(gfp_mask, vma, addr, order) \
-	alloc_pages_vma(gfp_mask, order, vma, addr, numa_node_id(), true)
+	alloc_pages_vma(gfp_mask, order, vma, addr, true)
 static inline struct page *alloc_pages(gfp_t gfp_mask, unsigned int order)
@@ -610,14 +610,14 @@  static inline struct folio *folio_alloc(gfp_t gfp, unsigned int order)
 	return __folio_alloc_node(gfp, order, numa_node_id());
-#define alloc_pages_vma(gfp_mask, order, vma, addr, node, false)\
+#define alloc_pages_vma(gfp_mask, order, vma, addr, false)\
 	alloc_pages(gfp_mask, order)
 #define alloc_hugepage_vma(gfp_mask, vma, addr, order) \
 	alloc_pages(gfp_mask, order)
 #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
 #define alloc_page_vma(gfp_mask, vma, addr)			\
-	alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id(), false)
+	alloc_pages_vma(gfp_mask, 0, vma, addr, false)
 extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order);
 extern unsigned long get_zeroed_page(gfp_t gfp_mask);
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index cdd6430932d1..b66e9bdfed66 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2143,9 +2143,10 @@  static struct page *alloc_pages_preferred_many(gfp_t gfp, unsigned int order,
  * Return: The page on success or NULL if allocation fails.
 struct page *alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
-		unsigned long addr, int node, bool hugepage)
+		unsigned long addr, bool hugepage)
 	struct mempolicy *pol;
+	int node = numa_node_id();
 	struct page *page;
 	int preferred_nid;
 	nodemask_t *nmask;
diff --git a/mm/shmem.c b/mm/shmem.c
index dc038ce78700..2d81f8d512d5 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1559,8 +1559,7 @@  static struct page *shmem_alloc_hugepage(gfp_t gfp,
 		return NULL;
 	shmem_pseudo_vma_init(&pvma, info, hindex);
-	page = alloc_pages_vma(gfp, HPAGE_PMD_ORDER, &pvma, 0, numa_node_id(),
-			       true);
+	page = alloc_pages_vma(gfp, HPAGE_PMD_ORDER, &pvma, 0, true);
 	if (page)