mm: vm_total_pages and build_all_zonelists() cleanup
Subsystems (7)
cover mm: vm_total_pages and build_all_zonelists() cleanup
Let's drop vm_total_pages and inline nr_free_pagecache_pages() into build_all_zonelists().
David Hildenbrand (2):
mm: drop vm_total_pages
mm/page_alloc: drop nr_free_pagecache_pages()
include/linux/swap.h | 2 -- mm/memory_hotplug.c | 3 --- mm/page-writeback.c | 6 ++---- mm/page_alloc.c | 18 ++++-------------- mm/vmscan.c | 5 ----- 5 files changed, 6 insertions(+), 28 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 mm: drop vm_total_pages
The global variable "vm_total_pages" is a relict from older days. There is only a single user that reads the variable - build_all_zonelists() - and the first thing it does is updating it. Use a local variable in build_all_zonelists() instead and drop the local variable.
--- include/linux/swap.h | 1 - mm/memory_hotplug.c | 3 --- mm/page-writeback.c | 6 ++---- mm/page_alloc.c | 2 ++ mm/vmscan.c | 5 ----- 5 files changed, 4 insertions(+), 13 deletions(-)
include/linux/swap.h +0 -1
@@ -371,7 +371,6 @@ extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem,extern unsigned long shrink_all_memory (unsigned long nr_pages);extern int vm_swappiness;extern int remove_mapping (struct address_space *mapping,struct page *page); -extern unsigned long vm_total_pages;extern unsigned long reclaim_pages (struct list_head *page_list);#ifdef CONFIG_NUMA
mm/memory_hotplug.c +0 -3
@@ -835,8 +835,6 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages,kswapd_run (nid);kcompactd_run (nid); - vm_total_pages =nr_free_pagecache_pages (); -writeback_set_ratelimit ();memory_notify (MEM_ONLINE , &arg);
@@ -1586,7 +1584,6 @@ static int __ref __offline_pages(unsigned long start_pfn,kcompactd_stop (node); } - vm_total_pages =nr_free_pagecache_pages ();writeback_set_ratelimit ();memory_notify (MEM_OFFLINE , &arg);
mm/page-writeback.c +2 -4
@@ -2076,13 +2076,11 @@ static int page_writeback_cpu_online(unsigned int cpu)* Called early on to tune the page writeback dirty limits. * * We used to scale dirty pages according to how total memory -* related to pages that could be allocated for buffers (by -* comparing nr_free_buffer_pages() to vm_total_pages. +* related to pages that could be allocated for buffers. * * However, that was when we used "dirty_ratio" to scale with * all memory, and we don't do that any more. "dirty_ratio" -* is now applied to total non-HIGHPAGE memory (by subtracting -* totalhigh_pages from vm_total_pages), and as such we can't +* is now applied to total non-HIGHPAGE memory, and as such we can't * get into the old insane situation any more where we had * large amounts of dirty pages compared to a small amount of * non-HIGHMEM memory.
mm/page_alloc.c +2 -0
@@ -5903,6 +5903,8 @@ build_all_zonelists_init(void)*/ void __ref build_all_zonelists (pg_data_t *pgdat) { +unsigned long vm_total_pages; +if (system_state ==SYSTEM_BOOTING ) {build_all_zonelists_init (); }else {
mm/vmscan.c +0 -5
@@ -170,11 +170,6 @@ struct scan_control {* From 0 .. 200. Higher means more swappy. */ int vm_swappiness =60 ; -/* -* The total number of pages which are beyond the high watermark within all -* zones. -*/ -unsigned long vm_total_pages;static void set_task_reclaim_state (struct task_struct *task,struct reclaim_state *rs)
Signature · 1 line
2.26.2
Re: [PATCH v1 1/2] mm: drop vm_total_pages
Quoted 5 lines · David Hildenbrand
The global variable "
vm_total_pages" is a relict from older days. There is only a single user that reads the variable -build_all_zonelists()- and the first thing it does is updating it. Use a local variable inbuild_all_zonelists()instead and drop the local variable.
Quoted 7 lines
Cc Andrew Morton <[email protected]>Cc Johannes Weiner <[email protected]>Cc Michal Hocko <[email protected]>Cc Huang Ying <[email protected]>Cc Minchan Kim <[email protected]>Cc Wei Yang <[email protected]>Signed-off-by David Hildenbrand <[email protected]>
Quoted 92 lines
---
include/linux/swap.h | 1 - mm/memory_hotplug.c | 3 --- mm/page-writeback.c | 6 ++---- mm/page_alloc.c | 2 ++ mm/vmscan.c | 5 ----- 5 files changed, 4 insertions(+), 13 deletions(-)include/linux/swap.h +0
-1@@ -371,7 +371,6 @@ extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem,extern unsigned long shrink_all_memory (unsigned long nr_pages);extern int vm_swappiness;extern int remove_mapping (struct address_space *mapping,struct page *page); -extern unsigned long vm_total_pages;extern unsigned long reclaim_pages (struct list_head *page_list);#ifdef CONFIG_NUMA mm/memory_hotplug.c +0
-3@@ -835,8 +835,6 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages,kswapd_run (nid);kcompactd_run (nid); - vm_total_pages =nr_free_pagecache_pages (); -writeback_set_ratelimit ();memory_notify (MEM_ONLINE , &arg);@@ -1586,7 +1584,6 @@ static int __ref __offline_pages(unsigned long start_pfn,kcompactd_stop (node); } - vm_total_pages =nr_free_pagecache_pages ();writeback_set_ratelimit ();memory_notify (MEM_OFFLINE , &arg);mm/page-writeback.c +2
-4@@ -2076,13 +2076,11 @@ static int page_writeback_cpu_online(unsigned int cpu)* Called early on to tune the page writeback dirty limits. * * We used to scale dirty pages according to how total memory -* related to pages that could be allocated for buffers (by -* comparing nr_free_buffer_pages() to vm_total_pages. +* related to pages that could be allocated for buffers. * * However, that was when we used "dirty_ratio" to scale with * all memory, and we don't do that any more. "dirty_ratio" -* is now applied to total non-HIGHPAGE memory (by subtracting -* totalhigh_pages from vm_total_pages), and as such we can't +* is now applied to total non-HIGHPAGE memory, and as such we can't * get into the old insane situation any more where we had * large amounts of dirty pages compared to a small amount of * non-HIGHMEM memory. mm/page_alloc.c +2
-0@@ -5903,6 +5903,8 @@ build_all_zonelists_init(void)*/ void __ref build_all_zonelists (pg_data_t *pgdat) { +unsigned long vm_total_pages; +if (system_state ==SYSTEM_BOOTING ) {build_all_zonelists_init (); }else {mm/vmscan.c +0
-5@@ -170,11 +170,6 @@ struct scan_control {* From 0 .. 200. Higher means more swappy. */ int vm_swappiness =60 ; -/* -* The total number of pages which are beyond the high watermark within all -* zones. -*/ -unsigned long vm_total_pages;static void set_task_reclaim_state (struct task_struct *task,struct reclaim_state *rs)Signature · 1 line
2.26.2
Signature · 2 lines
Wei Yang Help you, Help me
Re: [PATCH v1 1/2] mm: drop vm_total_pages
In reply to David HildenbrandQuoted 4 lines · David Hildenbrand
The global variable "
vm_total_pages" is a relict from older days. There is only a single user that reads the variable -build_all_zonelists()- and the first thing it does is updating it. Use a local variable inbuild_all_zonelists()instead and drop the local variable.
Nit: ^ global
Quoted 7 lines
Cc Andrew Morton <[email protected]>Cc Johannes Weiner <[email protected]>Cc Michal Hocko <[email protected]>Cc Huang Ying <[email protected]>Cc Minchan Kim <[email protected]>Cc Wei Yang <[email protected]>Signed-off-by David Hildenbrand <[email protected]>
Except the nit above
Quoted 94 lines
--- include/linux/swap.h | 1 - mm/memory_hotplug.c | 3 --- mm/page-writeback.c | 6 ++---- mm/page_alloc.c | 2 ++ mm/vmscan.c | 5 ----- 5 files changed, 4 insertions(+), 13 deletions(-)include/linux/swap.h +0
-1@@ -371,7 +371,6 @@ extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem,extern unsigned long shrink_all_memory (unsigned long nr_pages);extern int vm_swappiness;extern int remove_mapping (struct address_space *mapping,struct page *page); -extern unsigned long vm_total_pages;extern unsigned long reclaim_pages (struct list_head *page_list);#ifdef CONFIG_NUMA mm/memory_hotplug.c +0
-3@@ -835,8 +835,6 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages,kswapd_run (nid);kcompactd_run (nid); - vm_total_pages =nr_free_pagecache_pages (); -writeback_set_ratelimit ();memory_notify (MEM_ONLINE , &arg);@@ -1586,7 +1584,6 @@ static int __ref __offline_pages(unsigned long start_pfn,kcompactd_stop (node); } - vm_total_pages =nr_free_pagecache_pages ();writeback_set_ratelimit ();memory_notify (MEM_OFFLINE , &arg);mm/page-writeback.c +2
-4@@ -2076,13 +2076,11 @@ static int page_writeback_cpu_online(unsigned int cpu)* Called early on to tune the page writeback dirty limits. * * We used to scale dirty pages according to how total memory -* related to pages that could be allocated for buffers (by -* comparing nr_free_buffer_pages() to vm_total_pages. +* related to pages that could be allocated for buffers. * * However, that was when we used "dirty_ratio" to scale with * all memory, and we don't do that any more. "dirty_ratio" -* is now applied to total non-HIGHPAGE memory (by subtracting -* totalhigh_pages from vm_total_pages), and as such we can't +* is now applied to total non-HIGHPAGE memory, and as such we can't * get into the old insane situation any more where we had * large amounts of dirty pages compared to a small amount of * non-HIGHMEM memory. mm/page_alloc.c +2
-0@@ -5903,6 +5903,8 @@ build_all_zonelists_init(void)*/ void __ref build_all_zonelists (pg_data_t *pgdat) { +unsigned long vm_total_pages; +if (system_state ==SYSTEM_BOOTING ) {build_all_zonelists_init (); }else {mm/vmscan.c +0
-5@@ -170,11 +170,6 @@ struct scan_control {* From 0 .. 200. Higher means more swappy. */ int vm_swappiness =60 ; -/* -* The total number of pages which are beyond the high watermark within all -* zones. -*/ -unsigned long vm_total_pages;static void set_task_reclaim_state (struct task_struct *task,struct reclaim_state *rs)Signature · 1 line
2.26.2
Signature · 2 lines
Sincerely yours, Mike.
Re: [PATCH v1 1/2] mm: drop vm_total_pages
Quoted 7 lines · Mike Rapoport
Quoted 4 lines · David Hildenbrand
The global variable "
vm_total_pages" is a relict from older days. There is only a single user that reads the variable -build_all_zonelists()- and the first thing it does is updating it. Use a local variable inbuild_all_zonelists()instead and drop the local variable.Nit: ^ global
Indeed, @Andrew, can you fix this up?
Thanks!
Signature · 3 lines
Thanks, David / dhildenb
Re: [PATCH v1 1/2] mm: drop vm_total_pages
In reply to David HildenbrandQuoted 92 lines
The global variable "
vm_total_pages" is a relict from older days. There is only a single user that reads the variable -build_all_zonelists()- and the first thing it does is updating it. Use a local variable inbuild_all_zonelists()instead and drop the local variable.Cc Andrew Morton <[email protected]>Cc Johannes Weiner <[email protected]>Cc Michal Hocko <[email protected]>Cc Huang Ying <[email protected]>Cc Minchan Kim <[email protected]>Cc Wei Yang <[email protected]>Signed-off-by David Hildenbrand <[email protected]>--- include/linux/swap.h | 1 - mm/memory_hotplug.c | 3 --- mm/page-writeback.c | 6 ++---- mm/page_alloc.c | 2 ++ mm/vmscan.c | 5 ----- 5 files changed, 4 insertions(+), 13 deletions(-)include/linux/swap.h +0
-1@@ -371,7 +371,6 @@ extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem,extern unsigned long shrink_all_memory (unsigned long nr_pages);extern int vm_swappiness;extern int remove_mapping (struct address_space *mapping,struct page *page); -extern unsigned long vm_total_pages;extern unsigned long reclaim_pages (struct list_head *page_list);#ifdef CONFIG_NUMA mm/memory_hotplug.c +0
-3@@ -835,8 +835,6 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages,kswapd_run (nid);kcompactd_run (nid); - vm_total_pages =nr_free_pagecache_pages (); -writeback_set_ratelimit ();memory_notify (MEM_ONLINE , &arg);@@ -1586,7 +1584,6 @@ static int __ref __offline_pages(unsigned long start_pfn,kcompactd_stop (node); } - vm_total_pages =nr_free_pagecache_pages ();writeback_set_ratelimit ();memory_notify (MEM_OFFLINE , &arg);mm/page-writeback.c +2
-4@@ -2076,13 +2076,11 @@ static int page_writeback_cpu_online(unsigned int cpu)* Called early on to tune the page writeback dirty limits. * * We used to scale dirty pages according to how total memory -* related to pages that could be allocated for buffers (by -* comparing nr_free_buffer_pages() to vm_total_pages. +* related to pages that could be allocated for buffers. * * However, that was when we used "dirty_ratio" to scale with * all memory, and we don't do that any more. "dirty_ratio" -* is now applied to total non-HIGHPAGE memory (by subtracting -* totalhigh_pages from vm_total_pages), and as such we can't +* is now applied to total non-HIGHPAGE memory, and as such we can't * get into the old insane situation any more where we had * large amounts of dirty pages compared to a small amount of * non-HIGHMEM memory. mm/page_alloc.c +2
-0@@ -5903,6 +5903,8 @@ build_all_zonelists_init(void)*/ void __ref build_all_zonelists (pg_data_t *pgdat) { +unsigned long vm_total_pages; +if (system_state ==SYSTEM_BOOTING ) {build_all_zonelists_init (); }else {mm/vmscan.c +0
-0@@ -170,11 +170,6 @@ struct scan_control {* From 0 .. 200. Higher means more swappy.
mm/vmscan.c struct scan_control { · line 175
Quoted 10 lines
mm/vmscan.c +0
-5*/ int vm_swappiness =60 ; -/* -* The total number of pages which are beyond the high watermark within all -* zones. -*/ -unsigned long vm_total_pages;static void set_task_reclaim_state (struct task_struct *task,struct reclaim_state *rs)
Re: [PATCH v1 1/2] mm: drop vm_total_pages
In reply to David HildenbrandQuoted 5 lines · David Hildenbrand
The global variable "
vm_total_pages" is a relict from older days. There is only a single user that reads the variable -build_all_zonelists()- and the first thing it does is updating it. Use a local variable inbuild_all_zonelists()instead and drop the local variable.
Quoted 7 lines
Cc Andrew Morton <[email protected]>Cc Johannes Weiner <[email protected]>Cc Michal Hocko <[email protected]>Cc Huang Ying <[email protected]>Cc Minchan Kim <[email protected]>Cc Wei Yang <[email protected]>Signed-off-by David Hildenbrand <[email protected]>
Quoted 92 lines
--- include/linux/swap.h | 1 - mm/memory_hotplug.c | 3 --- mm/page-writeback.c | 6 ++---- mm/page_alloc.c | 2 ++ mm/vmscan.c | 5 ----- 5 files changed, 4 insertions(+), 13 deletions(-)include/linux/swap.h +0
-1@@ -371,7 +371,6 @@ extern unsigned long mem_cgroup_shrink_node(struct mem_cgroup *mem,extern unsigned long shrink_all_memory (unsigned long nr_pages);extern int vm_swappiness;extern int remove_mapping (struct address_space *mapping,struct page *page); -extern unsigned long vm_total_pages;extern unsigned long reclaim_pages (struct list_head *page_list);#ifdef CONFIG_NUMA mm/memory_hotplug.c +0
-3@@ -835,8 +835,6 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages,kswapd_run (nid);kcompactd_run (nid); - vm_total_pages =nr_free_pagecache_pages (); -writeback_set_ratelimit ();memory_notify (MEM_ONLINE , &arg);@@ -1586,7 +1584,6 @@ static int __ref __offline_pages(unsigned long start_pfn,kcompactd_stop (node); } - vm_total_pages =nr_free_pagecache_pages ();writeback_set_ratelimit ();memory_notify (MEM_OFFLINE , &arg);mm/page-writeback.c +2
-4@@ -2076,13 +2076,11 @@ static int page_writeback_cpu_online(unsigned int cpu)* Called early on to tune the page writeback dirty limits. * * We used to scale dirty pages according to how total memory -* related to pages that could be allocated for buffers (by -* comparing nr_free_buffer_pages() to vm_total_pages. +* related to pages that could be allocated for buffers. * * However, that was when we used "dirty_ratio" to scale with * all memory, and we don't do that any more. "dirty_ratio" -* is now applied to total non-HIGHPAGE memory (by subtracting -* totalhigh_pages from vm_total_pages), and as such we can't +* is now applied to total non-HIGHPAGE memory, and as such we can't * get into the old insane situation any more where we had * large amounts of dirty pages compared to a small amount of * non-HIGHMEM memory. mm/page_alloc.c +2
-0@@ -5903,6 +5903,8 @@ build_all_zonelists_init(void)*/ void __ref build_all_zonelists (pg_data_t *pgdat) { +unsigned long vm_total_pages; +if (system_state ==SYSTEM_BOOTING ) {build_all_zonelists_init (); }else {mm/vmscan.c +0
-5@@ -170,11 +170,6 @@ struct scan_control {* From 0 .. 200. Higher means more swappy. */ int vm_swappiness =60 ; -/* -* The total number of pages which are beyond the high watermark within all -* zones. -*/ -unsigned long vm_total_pages;static void set_task_reclaim_state (struct task_struct *task,struct reclaim_state *rs)Signature · 1 line
2.26.2
Signature · 2 lines
Michal Hocko SUSE Labs
PATCH 2/2 mm/page_alloc: drop nr_free_pagecache_pages()
In reply to David Hildenbrandnr_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.
--- include/linux/swap.h | 1 - mm/page_alloc.c | 16 ++-------------- 2 files changed, 2 insertions(+), 15 deletions(-)
include/linux/swap.h +0 -1
@@ -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)
mm/page_alloc.c +2 -14
@@ -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
Signature · 1 line
2.26.2
Re: [PATCH v1 2/2] mm/page_alloc: drop nr_free_pagecache_pages()
Quoted 3 lines · David Hildenbrand
nr_free_pagecache_pages()isn't used outsidepage_alloc.canymore - 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.
Quoted 8 lines
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:
Quoted 53 lines
---
include/linux/swap.h| 1 -mm/page_alloc.c| 16 ++--------------2 files changed, 2 insertions(+), 15 deletions(-)include/linux/swap.h +0
-1@@ -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)mm/page_alloc.c +2
-14@@ -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 Signature · 1 line
2.26.2
Signature · 2 lines
Wei Yang Help you, Help me
Re: [PATCH v1 2/2] mm/page_alloc: drop nr_free_pagecache_pages()
In reply to David HildenbrandQuoted 11 lines · David Hildenbrand
nr_free_pagecache_pages()isn't used outsidepage_alloc.canymore - 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]>
Quoted 55 lines
--- include/linux/swap.h | 1 - mm/page_alloc.c | 16 ++-------------- 2 files changed, 2 insertions(+), 15 deletions(-)include/linux/swap.h +0
-1@@ -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)mm/page_alloc.c +2
-14@@ -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 Signature · 1 line
2.26.2
Signature · 2 lines
Sincerely yours, Mike.
Re: [PATCH v1 2/2] mm/page_alloc: drop nr_free_pagecache_pages()
In reply to David HildenbrandQuoted 53 lines
nr_free_pagecache_pages()isn't used outsidepage_alloc.canymore - 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(-)include/linux/swap.h +0
-1@@ -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)mm/page_alloc.c +0
-13@@ -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 ))
mm/page_alloc.c void __ref build_all_zonelists(pg_data_t *pgdat) · line 5905
Quoted 9 lines
mm/page_alloc.c +2
-1@@ -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
Re: [PATCH v1 2/2] mm/page_alloc: drop nr_free_pagecache_pages()
In reply to David HildenbrandQuoted 11 lines · David Hildenbrand
nr_free_pagecache_pages()isn't used outsidepage_alloc.canymore - 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).
Quoted 53 lines
--- include/linux/swap.h | 1 - mm/page_alloc.c | 16 ++-------------- 2 files changed, 2 insertions(+), 15 deletions(-)include/linux/swap.h +0
-1@@ -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)mm/page_alloc.c +2
-14@@ -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 Signature · 1 line
2.26.2
Signature · 2 lines
Michal Hocko SUSE Labs