diff mbox series

[3/2] mm: Rename alloc_pages_current to alloc_pages

Message ID 20210124171107.GC308988@casper.infradead.org (mailing list archive)
State New, archived
Headers show
Series Get rid of __alloc_pages wrapper | expand

Commit Message

Matthew Wilcox (Oracle) Jan. 24, 2021, 5:11 p.m. UTC
When CONFIG_NUMA is enabled, alloc_pages() is a wrapper around
alloc_pages_current().  This is pointless, just implement alloc_pages()
directly.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 include/linux/gfp.h |  8 +-------
 mm/mempolicy.c      | 27 +++++++++++++--------------
 2 files changed, 14 insertions(+), 21 deletions(-)

Comments

Vlastimil Babka Jan. 26, 2021, 4:05 p.m. UTC | #1
On 1/24/21 6:11 PM, Matthew Wilcox wrote:
> When CONFIG_NUMA is enabled, alloc_pages() is a wrapper around
> alloc_pages_current().  This is pointless, just implement alloc_pages()
> directly.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Vlastimil Babka <vbabka@suse.cz>
Michal Hocko Jan. 27, 2021, 9:39 a.m. UTC | #2
On Sun 24-01-21 17:11:07, Matthew Wilcox wrote:
> When CONFIG_NUMA is enabled, alloc_pages() is a wrapper around
> alloc_pages_current().  This is pointless, just implement alloc_pages()
> directly.

alloc_pages_current was a bit of a misnomer anyway as it implements
memory policy as well (e.g. interleave).

> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Michal Hocko <mhocko@suse.com>

Thanks!

> ---
>  include/linux/gfp.h |  8 +-------
>  mm/mempolicy.c      | 27 +++++++++++++--------------
>  2 files changed, 14 insertions(+), 21 deletions(-)
> 
> diff --git a/include/linux/gfp.h b/include/linux/gfp.h
> index acca2c487da8..44978b35ce1a 100644
> --- a/include/linux/gfp.h
> +++ b/include/linux/gfp.h
> @@ -532,13 +532,7 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
>  }
>  
>  #ifdef CONFIG_NUMA
> -extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order);
> -
> -static inline struct page *
> -alloc_pages(gfp_t gfp_mask, unsigned int order)
> -{
> -	return alloc_pages_current(gfp_mask, order);
> -}
> +struct page *alloc_pages(gfp_t gfp, unsigned int 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);
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index addf0854d693..0cf54aa5a2f0 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -2245,21 +2245,20 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
>  EXPORT_SYMBOL(alloc_pages_vma);
>  
>  /**
> - * 	alloc_pages_current - Allocate pages.
> + * alloc_pages - Allocate pages.
> + * @gfp:
> + *	%GFP_USER   user allocation,
> + *	%GFP_KERNEL kernel allocation,
> + *	%GFP_HIGHMEM highmem allocation,
> + *	%GFP_FS     don't call back into a file system.
> + *	%GFP_ATOMIC don't sleep.
> + * @order: Power of two of allocation size in pages. 0 is a single page.
>   *
> - *	@gfp:
> - *		%GFP_USER   user allocation,
> - *      	%GFP_KERNEL kernel allocation,
> - *      	%GFP_HIGHMEM highmem allocation,
> - *      	%GFP_FS     don't call back into a file system.
> - *      	%GFP_ATOMIC don't sleep.
> - *	@order: Power of two of allocation size in pages. 0 is a single page.
> - *
> - *	Allocate a page from the kernel page pool.  When not in
> - *	interrupt context and apply the current process NUMA policy.
> - *	Returns NULL when no page can be allocated.
> + * Allocate a page from the kernel page pool.  When in
> + * process context apply the current process NUMA policy.
> + * Returns NULL when no page can be allocated.
>   */
> -struct page *alloc_pages_current(gfp_t gfp, unsigned order)
> +struct page *alloc_pages(gfp_t gfp, unsigned order)
>  {
>  	struct mempolicy *pol = &default_policy;
>  	struct page *page;
> @@ -2280,7 +2279,7 @@ struct page *alloc_pages_current(gfp_t gfp, unsigned order)
>  
>  	return page;
>  }
> -EXPORT_SYMBOL(alloc_pages_current);
> +EXPORT_SYMBOL(alloc_pages);
>  
>  int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst)
>  {
> -- 
> 2.29.2
>
diff mbox series

Patch

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index acca2c487da8..44978b35ce1a 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -532,13 +532,7 @@  static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
 }
 
 #ifdef CONFIG_NUMA
-extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order);
-
-static inline struct page *
-alloc_pages(gfp_t gfp_mask, unsigned int order)
-{
-	return alloc_pages_current(gfp_mask, order);
-}
+struct page *alloc_pages(gfp_t gfp, unsigned int 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);
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index addf0854d693..0cf54aa5a2f0 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2245,21 +2245,20 @@  alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
 EXPORT_SYMBOL(alloc_pages_vma);
 
 /**
- * 	alloc_pages_current - Allocate pages.
+ * alloc_pages - Allocate pages.
+ * @gfp:
+ *	%GFP_USER   user allocation,
+ *	%GFP_KERNEL kernel allocation,
+ *	%GFP_HIGHMEM highmem allocation,
+ *	%GFP_FS     don't call back into a file system.
+ *	%GFP_ATOMIC don't sleep.
+ * @order: Power of two of allocation size in pages. 0 is a single page.
  *
- *	@gfp:
- *		%GFP_USER   user allocation,
- *      	%GFP_KERNEL kernel allocation,
- *      	%GFP_HIGHMEM highmem allocation,
- *      	%GFP_FS     don't call back into a file system.
- *      	%GFP_ATOMIC don't sleep.
- *	@order: Power of two of allocation size in pages. 0 is a single page.
- *
- *	Allocate a page from the kernel page pool.  When not in
- *	interrupt context and apply the current process NUMA policy.
- *	Returns NULL when no page can be allocated.
+ * Allocate a page from the kernel page pool.  When in
+ * process context apply the current process NUMA policy.
+ * Returns NULL when no page can be allocated.
  */
-struct page *alloc_pages_current(gfp_t gfp, unsigned order)
+struct page *alloc_pages(gfp_t gfp, unsigned order)
 {
 	struct mempolicy *pol = &default_policy;
 	struct page *page;
@@ -2280,7 +2279,7 @@  struct page *alloc_pages_current(gfp_t gfp, unsigned order)
 
 	return page;
 }
-EXPORT_SYMBOL(alloc_pages_current);
+EXPORT_SYMBOL(alloc_pages);
 
 int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst)
 {