Skip to content

Commit

Permalink
mm: remove vm_total_pages
Browse files Browse the repository at this point in the history
The global variable "vm_total_pages" is a relic from older days.  There is
only a single user that reads the variable - build_all_zonelists() - and
the first thing it does is update it.

Use a local variable in build_all_zonelists() instead and remove the
global variable.

Signed-off-by: David Hildenbrand <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Wei Yang <[email protected]>
Reviewed-by: Pankaj Gupta <[email protected]>
Reviewed-by: Mike Rapoport <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Huang Ying <[email protected]>
Cc: Minchan Kim <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
davidhildenbrand authored and torvalds committed Aug 7, 2020
1 parent f80b08f commit 0a18e60
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion include/linux/swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,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
Expand Down
3 changes: 0 additions & 3 deletions mm/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,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);
Expand Down Expand Up @@ -1595,7 +1593,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);
Expand Down
6 changes: 2 additions & 4 deletions mm/page-writeback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5912,6 +5912,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 {
Expand Down
5 changes: 0 additions & 5 deletions mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 0a18e60

Please sign in to comment.