nr_free_pagecache_pages() isn't used outside page_alloc.c anymore - and
the name does not really help to understand what's going on. Let's inline
it instead and add a comment.
Cc: Andrew Morton <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Huang Ying <[email protected]>
Cc: Wei Yang <[email protected]>
Signed-off-by: David Hildenbrand <[email protected]>
---
include/linux/swap.h | 1 -
mm/page_alloc.c | 16 ++--------------
2 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 124261acd5d0a..9bde6c6b2c045 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -327,7 +327,6 @@ void workingset_update_node(struct xa_node *node);
/* linux/mm/page_alloc.c */
extern unsigned long totalreserve_pages;
extern unsigned long nr_free_buffer_pages(void);
-extern unsigned long nr_free_pagecache_pages(void);
/* Definition of global_zone_page_state not available yet */
#define nr_free_pages() global_zone_page_state(NR_FREE_PAGES)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 7b0dde69748c1..c38903d1b3b4d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5177,19 +5177,6 @@ unsigned long nr_free_buffer_pages(void)
}
EXPORT_SYMBOL_GPL(nr_free_buffer_pages);
-/**
- * nr_free_pagecache_pages - count number of pages beyond high watermark
- *
- * nr_free_pagecache_pages() counts the number of pages which are beyond the
- * high watermark within all zones.
- *
- * Return: number of pages beyond high watermark within all zones.
- */
-unsigned long nr_free_pagecache_pages(void)
-{
- return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
-}
-
static inline void show_node(struct zone *zone)
{
if (IS_ENABLED(CONFIG_NUMA))
@@ -5911,7 +5898,8 @@ void __ref build_all_zonelists(pg_data_t *pgdat)
__build_all_zonelists(pgdat);
/* cpuset refresh routine should be here */
}
- vm_total_pages = nr_free_pagecache_pages();
+ /* Get the number of free pages beyond high watermark in all zones. */
+ vm_total_pages = nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
/*
* Disable grouping by mobility if the number of pages in the
* system is too low to allow the mechanism to work. It would be
--
2.26.2
On Fri, Jun 19, 2020 at 03:24:10PM +0200, David Hildenbrand wrote:
>nr_free_pagecache_pages() isn't used outside page_alloc.c anymore - and
>the name does not really help to understand what's going on. Let's inline
>it instead and add a comment.
Not sure "inline it" is the proper word for this.
>
>Cc: Andrew Morton <[email protected]>
>Cc: Johannes Weiner <[email protected]>
>Cc: Michal Hocko <[email protected]>
>Cc: Minchan Kim <[email protected]>
>Cc: Huang Ying <[email protected]>
>Cc: Wei Yang <[email protected]>
>Signed-off-by: David Hildenbrand <[email protected]>
Besides:
Reviewed-by: Wei Yang <[email protected]>
>---
> include/linux/swap.h | 1 -
> mm/page_alloc.c | 16 ++--------------
> 2 files changed, 2 insertions(+), 15 deletions(-)
>
>diff --git a/include/linux/swap.h b/include/linux/swap.h
>index 124261acd5d0a..9bde6c6b2c045 100644
>--- a/include/linux/swap.h
>+++ b/include/linux/swap.h
>@@ -327,7 +327,6 @@ void workingset_update_node(struct xa_node *node);
> /* linux/mm/page_alloc.c */
> extern unsigned long totalreserve_pages;
> extern unsigned long nr_free_buffer_pages(void);
>-extern unsigned long nr_free_pagecache_pages(void);
>
> /* Definition of global_zone_page_state not available yet */
> #define nr_free_pages() global_zone_page_state(NR_FREE_PAGES)
>diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>index 7b0dde69748c1..c38903d1b3b4d 100644
>--- a/mm/page_alloc.c
>+++ b/mm/page_alloc.c
>@@ -5177,19 +5177,6 @@ unsigned long nr_free_buffer_pages(void)
> }
> EXPORT_SYMBOL_GPL(nr_free_buffer_pages);
>
>-/**
>- * nr_free_pagecache_pages - count number of pages beyond high watermark
>- *
>- * nr_free_pagecache_pages() counts the number of pages which are beyond the
>- * high watermark within all zones.
>- *
>- * Return: number of pages beyond high watermark within all zones.
>- */
>-unsigned long nr_free_pagecache_pages(void)
>-{
>- return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
>-}
>-
> static inline void show_node(struct zone *zone)
> {
> if (IS_ENABLED(CONFIG_NUMA))
>@@ -5911,7 +5898,8 @@ void __ref build_all_zonelists(pg_data_t *pgdat)
> __build_all_zonelists(pgdat);
> /* cpuset refresh routine should be here */
> }
>- vm_total_pages = nr_free_pagecache_pages();
>+ /* Get the number of free pages beyond high watermark in all zones. */
>+ vm_total_pages = nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
> /*
> * Disable grouping by mobility if the number of pages in the
> * system is too low to allow the mechanism to work. It would be
>--
>2.26.2
--
Wei Yang
Help you, Help me
On Fri, Jun 19, 2020 at 03:24:10PM +0200, David Hildenbrand wrote:
> nr_free_pagecache_pages() isn't used outside page_alloc.c anymore - and
> the name does not really help to understand what's going on. Let's inline
> it instead and add a comment.
>
> Cc: Andrew Morton <[email protected]>
> Cc: Johannes Weiner <[email protected]>
> Cc: Michal Hocko <[email protected]>
> Cc: Minchan Kim <[email protected]>
> Cc: Huang Ying <[email protected]>
> Cc: Wei Yang <[email protected]>
> Signed-off-by: David Hildenbrand <[email protected]>
Reviewed-by: Mike Rapoport <[email protected]>
> ---
> include/linux/swap.h | 1 -
> mm/page_alloc.c | 16 ++--------------
> 2 files changed, 2 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/swap.h b/include/linux/swap.h
> index 124261acd5d0a..9bde6c6b2c045 100644
> --- a/include/linux/swap.h
> +++ b/include/linux/swap.h
> @@ -327,7 +327,6 @@ void workingset_update_node(struct xa_node *node);
> /* linux/mm/page_alloc.c */
> extern unsigned long totalreserve_pages;
> extern unsigned long nr_free_buffer_pages(void);
> -extern unsigned long nr_free_pagecache_pages(void);
>
> /* Definition of global_zone_page_state not available yet */
> #define nr_free_pages() global_zone_page_state(NR_FREE_PAGES)
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 7b0dde69748c1..c38903d1b3b4d 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5177,19 +5177,6 @@ unsigned long nr_free_buffer_pages(void)
> }
> EXPORT_SYMBOL_GPL(nr_free_buffer_pages);
>
> -/**
> - * nr_free_pagecache_pages - count number of pages beyond high watermark
> - *
> - * nr_free_pagecache_pages() counts the number of pages which are beyond the
> - * high watermark within all zones.
> - *
> - * Return: number of pages beyond high watermark within all zones.
> - */
> -unsigned long nr_free_pagecache_pages(void)
> -{
> - return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
> -}
> -
> static inline void show_node(struct zone *zone)
> {
> if (IS_ENABLED(CONFIG_NUMA))
> @@ -5911,7 +5898,8 @@ void __ref build_all_zonelists(pg_data_t *pgdat)
> __build_all_zonelists(pgdat);
> /* cpuset refresh routine should be here */
> }
> - vm_total_pages = nr_free_pagecache_pages();
> + /* Get the number of free pages beyond high watermark in all zones. */
> + vm_total_pages = nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
> /*
> * Disable grouping by mobility if the number of pages in the
> * system is too low to allow the mechanism to work. It would be
> --
> 2.26.2
>
>
--
Sincerely yours,
Mike.
> nr_free_pagecache_pages() isn't used outside page_alloc.c anymore - and
> the name does not really help to understand what's going on. Let's inline
> it instead and add a comment.
>
> Cc: Andrew Morton <[email protected]>
> Cc: Johannes Weiner <[email protected]>
> Cc: Michal Hocko <[email protected]>
> Cc: Minchan Kim <[email protected]>
> Cc: Huang Ying <[email protected]>
> Cc: Wei Yang <[email protected]>
> Signed-off-by: David Hildenbrand <[email protected]>
> ---
> include/linux/swap.h | 1 -
> mm/page_alloc.c | 16 ++--------------
> 2 files changed, 2 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/swap.h b/include/linux/swap.h
> index 124261acd5d0a..9bde6c6b2c045 100644
> --- a/include/linux/swap.h
> +++ b/include/linux/swap.h
> @@ -327,7 +327,6 @@ void workingset_update_node(struct xa_node *node);
> /* linux/mm/page_alloc.c */
> extern unsigned long totalreserve_pages;
> extern unsigned long nr_free_buffer_pages(void);
> -extern unsigned long nr_free_pagecache_pages(void);
>
> /* Definition of global_zone_page_state not available yet */
> #define nr_free_pages() global_zone_page_state(NR_FREE_PAGES)
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 7b0dde69748c1..c38903d1b3b4d 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5177,19 +5177,6 @@ unsigned long nr_free_buffer_pages(void)
> }
> EXPORT_SYMBOL_GPL(nr_free_buffer_pages);
>
> -/**
> - * nr_free_pagecache_pages - count number of pages beyond high watermark
> - *
> - * nr_free_pagecache_pages() counts the number of pages which are beyond the
> - * high watermark within all zones.
> - *
> - * Return: number of pages beyond high watermark within all zones.
> - */
> -unsigned long nr_free_pagecache_pages(void)
> -{
> - return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
> -}
> -
> static inline void show_node(struct zone *zone)
> {
> if (IS_ENABLED(CONFIG_NUMA))
> @@ -5911,7 +5898,8 @@ void __ref build_all_zonelists(pg_data_t *pgdat)
> __build_all_zonelists(pgdat);
> /* cpuset refresh routine should be here */
> }
> - vm_total_pages = nr_free_pagecache_pages();
> + /* Get the number of free pages beyond high watermark in all zones. */
> + vm_total_pages = nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
> /*
> * Disable grouping by mobility if the number of pages in the
> * system is too low to allow the mechanism to work. It would be
Reviewed-by: Pankaj Gupta <[email protected]>
On Fri 19-06-20 15:24:10, David Hildenbrand wrote:
> nr_free_pagecache_pages() isn't used outside page_alloc.c anymore - and
> the name does not really help to understand what's going on. Let's inline
> it instead and add a comment.
>
> Cc: Andrew Morton <[email protected]>
> Cc: Johannes Weiner <[email protected]>
> Cc: Michal Hocko <[email protected]>
> Cc: Minchan Kim <[email protected]>
> Cc: Huang Ying <[email protected]>
> Cc: Wei Yang <[email protected]>
> Signed-off-by: David Hildenbrand <[email protected]>
nr_free_pagecache_pages was an awkward name which kind of makes sense
but it is terribly confusing (e.g. there are pagecache consumers
restricted to lowmem zones only).
Acked-by: Michal Hocko <[email protected]>
> ---
> include/linux/swap.h | 1 -
> mm/page_alloc.c | 16 ++--------------
> 2 files changed, 2 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/swap.h b/include/linux/swap.h
> index 124261acd5d0a..9bde6c6b2c045 100644
> --- a/include/linux/swap.h
> +++ b/include/linux/swap.h
> @@ -327,7 +327,6 @@ void workingset_update_node(struct xa_node *node);
> /* linux/mm/page_alloc.c */
> extern unsigned long totalreserve_pages;
> extern unsigned long nr_free_buffer_pages(void);
> -extern unsigned long nr_free_pagecache_pages(void);
>
> /* Definition of global_zone_page_state not available yet */
> #define nr_free_pages() global_zone_page_state(NR_FREE_PAGES)
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 7b0dde69748c1..c38903d1b3b4d 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5177,19 +5177,6 @@ unsigned long nr_free_buffer_pages(void)
> }
> EXPORT_SYMBOL_GPL(nr_free_buffer_pages);
>
> -/**
> - * nr_free_pagecache_pages - count number of pages beyond high watermark
> - *
> - * nr_free_pagecache_pages() counts the number of pages which are beyond the
> - * high watermark within all zones.
> - *
> - * Return: number of pages beyond high watermark within all zones.
> - */
> -unsigned long nr_free_pagecache_pages(void)
> -{
> - return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
> -}
> -
> static inline void show_node(struct zone *zone)
> {
> if (IS_ENABLED(CONFIG_NUMA))
> @@ -5911,7 +5898,8 @@ void __ref build_all_zonelists(pg_data_t *pgdat)
> __build_all_zonelists(pgdat);
> /* cpuset refresh routine should be here */
> }
> - vm_total_pages = nr_free_pagecache_pages();
> + /* Get the number of free pages beyond high watermark in all zones. */
> + vm_total_pages = nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
> /*
> * Disable grouping by mobility if the number of pages in the
> * system is too low to allow the mechanism to work. It would be
> --
> 2.26.2
--
Michal Hocko
SUSE Labs