mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-04 13:21:45 +00:00
mm: move page mapped accounting to the node
Reclaim makes decisions based on the number of pages that are mapped but it's mixing node and zone information. Account NR_FILE_MAPPED and NR_ANON_PAGES pages on the node. Link: http://lkml.kernel.org/r/1467970510-21195-18-git-send-email-mgorman@techsingularity.net Signed-off-by: Mel Gorman <mgorman@techsingularity.net> Acked-by: Vlastimil Babka <vbabka@suse.cz> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Hillf Danton <hillf.zj@alibaba-inc.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Rik van Riel <riel@surriel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
281e37265f
commit
50658e2e04
8 changed files with 21 additions and 21 deletions
|
@ -55,7 +55,7 @@ void show_mem(unsigned int filter)
|
||||||
global_page_state(NR_FREE_PAGES),
|
global_page_state(NR_FREE_PAGES),
|
||||||
(global_page_state(NR_SLAB_RECLAIMABLE) +
|
(global_page_state(NR_SLAB_RECLAIMABLE) +
|
||||||
global_page_state(NR_SLAB_UNRECLAIMABLE)),
|
global_page_state(NR_SLAB_UNRECLAIMABLE)),
|
||||||
global_page_state(NR_FILE_MAPPED),
|
global_node_page_state(NR_FILE_MAPPED),
|
||||||
global_page_state(NR_PAGETABLE),
|
global_page_state(NR_PAGETABLE),
|
||||||
global_page_state(NR_BOUNCE),
|
global_page_state(NR_BOUNCE),
|
||||||
global_page_state(NR_FILE_PAGES),
|
global_page_state(NR_FILE_PAGES),
|
||||||
|
|
|
@ -121,8 +121,8 @@ static ssize_t node_read_meminfo(struct device *dev,
|
||||||
nid, K(sum_zone_node_page_state(nid, NR_FILE_DIRTY)),
|
nid, K(sum_zone_node_page_state(nid, NR_FILE_DIRTY)),
|
||||||
nid, K(sum_zone_node_page_state(nid, NR_WRITEBACK)),
|
nid, K(sum_zone_node_page_state(nid, NR_WRITEBACK)),
|
||||||
nid, K(sum_zone_node_page_state(nid, NR_FILE_PAGES)),
|
nid, K(sum_zone_node_page_state(nid, NR_FILE_PAGES)),
|
||||||
nid, K(sum_zone_node_page_state(nid, NR_FILE_MAPPED)),
|
nid, K(node_page_state(pgdat, NR_FILE_MAPPED)),
|
||||||
nid, K(sum_zone_node_page_state(nid, NR_ANON_PAGES)),
|
nid, K(node_page_state(pgdat, NR_ANON_PAGES)),
|
||||||
nid, K(i.sharedram),
|
nid, K(i.sharedram),
|
||||||
nid, sum_zone_node_page_state(nid, NR_KERNEL_STACK) *
|
nid, sum_zone_node_page_state(nid, NR_KERNEL_STACK) *
|
||||||
THREAD_SIZE / 1024,
|
THREAD_SIZE / 1024,
|
||||||
|
|
|
@ -140,8 +140,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
|
||||||
K(i.freeswap),
|
K(i.freeswap),
|
||||||
K(global_page_state(NR_FILE_DIRTY)),
|
K(global_page_state(NR_FILE_DIRTY)),
|
||||||
K(global_page_state(NR_WRITEBACK)),
|
K(global_page_state(NR_WRITEBACK)),
|
||||||
K(global_page_state(NR_ANON_PAGES)),
|
K(global_node_page_state(NR_ANON_PAGES)),
|
||||||
K(global_page_state(NR_FILE_MAPPED)),
|
K(global_node_page_state(NR_FILE_MAPPED)),
|
||||||
K(i.sharedram),
|
K(i.sharedram),
|
||||||
K(global_page_state(NR_SLAB_RECLAIMABLE) +
|
K(global_page_state(NR_SLAB_RECLAIMABLE) +
|
||||||
global_page_state(NR_SLAB_UNRECLAIMABLE)),
|
global_page_state(NR_SLAB_UNRECLAIMABLE)),
|
||||||
|
|
|
@ -115,9 +115,6 @@ enum zone_stat_item {
|
||||||
NR_ZONE_LRU_ANON = NR_ZONE_LRU_BASE,
|
NR_ZONE_LRU_ANON = NR_ZONE_LRU_BASE,
|
||||||
NR_ZONE_LRU_FILE,
|
NR_ZONE_LRU_FILE,
|
||||||
NR_MLOCK, /* mlock()ed pages found and moved off LRU */
|
NR_MLOCK, /* mlock()ed pages found and moved off LRU */
|
||||||
NR_ANON_PAGES, /* Mapped anonymous pages */
|
|
||||||
NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
|
|
||||||
only modified from process context */
|
|
||||||
NR_FILE_PAGES,
|
NR_FILE_PAGES,
|
||||||
NR_FILE_DIRTY,
|
NR_FILE_DIRTY,
|
||||||
NR_WRITEBACK,
|
NR_WRITEBACK,
|
||||||
|
@ -164,6 +161,9 @@ enum node_stat_item {
|
||||||
WORKINGSET_REFAULT,
|
WORKINGSET_REFAULT,
|
||||||
WORKINGSET_ACTIVATE,
|
WORKINGSET_ACTIVATE,
|
||||||
WORKINGSET_NODERECLAIM,
|
WORKINGSET_NODERECLAIM,
|
||||||
|
NR_ANON_PAGES, /* Mapped anonymous pages */
|
||||||
|
NR_FILE_MAPPED, /* pagecache pages mapped into pagetables.
|
||||||
|
only modified from process context */
|
||||||
NR_VM_NODE_STAT_ITEMS
|
NR_VM_NODE_STAT_ITEMS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4312,7 +4312,7 @@ void show_free_areas(unsigned int filter)
|
||||||
global_page_state(NR_UNSTABLE_NFS),
|
global_page_state(NR_UNSTABLE_NFS),
|
||||||
global_page_state(NR_SLAB_RECLAIMABLE),
|
global_page_state(NR_SLAB_RECLAIMABLE),
|
||||||
global_page_state(NR_SLAB_UNRECLAIMABLE),
|
global_page_state(NR_SLAB_UNRECLAIMABLE),
|
||||||
global_page_state(NR_FILE_MAPPED),
|
global_node_page_state(NR_FILE_MAPPED),
|
||||||
global_page_state(NR_SHMEM),
|
global_page_state(NR_SHMEM),
|
||||||
global_page_state(NR_PAGETABLE),
|
global_page_state(NR_PAGETABLE),
|
||||||
global_page_state(NR_BOUNCE),
|
global_page_state(NR_BOUNCE),
|
||||||
|
@ -4334,6 +4334,7 @@ void show_free_areas(unsigned int filter)
|
||||||
" unevictable:%lukB"
|
" unevictable:%lukB"
|
||||||
" isolated(anon):%lukB"
|
" isolated(anon):%lukB"
|
||||||
" isolated(file):%lukB"
|
" isolated(file):%lukB"
|
||||||
|
" mapped:%lukB"
|
||||||
" all_unreclaimable? %s"
|
" all_unreclaimable? %s"
|
||||||
"\n",
|
"\n",
|
||||||
pgdat->node_id,
|
pgdat->node_id,
|
||||||
|
@ -4344,6 +4345,7 @@ void show_free_areas(unsigned int filter)
|
||||||
K(node_page_state(pgdat, NR_UNEVICTABLE)),
|
K(node_page_state(pgdat, NR_UNEVICTABLE)),
|
||||||
K(node_page_state(pgdat, NR_ISOLATED_ANON)),
|
K(node_page_state(pgdat, NR_ISOLATED_ANON)),
|
||||||
K(node_page_state(pgdat, NR_ISOLATED_FILE)),
|
K(node_page_state(pgdat, NR_ISOLATED_FILE)),
|
||||||
|
K(node_page_state(pgdat, NR_FILE_MAPPED)),
|
||||||
!pgdat_reclaimable(pgdat) ? "yes" : "no");
|
!pgdat_reclaimable(pgdat) ? "yes" : "no");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4368,7 +4370,6 @@ void show_free_areas(unsigned int filter)
|
||||||
" mlocked:%lukB"
|
" mlocked:%lukB"
|
||||||
" dirty:%lukB"
|
" dirty:%lukB"
|
||||||
" writeback:%lukB"
|
" writeback:%lukB"
|
||||||
" mapped:%lukB"
|
|
||||||
" shmem:%lukB"
|
" shmem:%lukB"
|
||||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||||
" shmem_thp: %lukB"
|
" shmem_thp: %lukB"
|
||||||
|
@ -4397,7 +4398,6 @@ void show_free_areas(unsigned int filter)
|
||||||
K(zone_page_state(zone, NR_MLOCK)),
|
K(zone_page_state(zone, NR_MLOCK)),
|
||||||
K(zone_page_state(zone, NR_FILE_DIRTY)),
|
K(zone_page_state(zone, NR_FILE_DIRTY)),
|
||||||
K(zone_page_state(zone, NR_WRITEBACK)),
|
K(zone_page_state(zone, NR_WRITEBACK)),
|
||||||
K(zone_page_state(zone, NR_FILE_MAPPED)),
|
|
||||||
K(zone_page_state(zone, NR_SHMEM)),
|
K(zone_page_state(zone, NR_SHMEM)),
|
||||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||||
K(zone_page_state(zone, NR_SHMEM_THPS) * HPAGE_PMD_NR),
|
K(zone_page_state(zone, NR_SHMEM_THPS) * HPAGE_PMD_NR),
|
||||||
|
|
14
mm/rmap.c
14
mm/rmap.c
|
@ -1214,7 +1214,7 @@ void do_page_add_anon_rmap(struct page *page,
|
||||||
*/
|
*/
|
||||||
if (compound)
|
if (compound)
|
||||||
__inc_zone_page_state(page, NR_ANON_THPS);
|
__inc_zone_page_state(page, NR_ANON_THPS);
|
||||||
__mod_zone_page_state(page_zone(page), NR_ANON_PAGES, nr);
|
__mod_node_page_state(page_pgdat(page), NR_ANON_PAGES, nr);
|
||||||
}
|
}
|
||||||
if (unlikely(PageKsm(page)))
|
if (unlikely(PageKsm(page)))
|
||||||
return;
|
return;
|
||||||
|
@ -1258,7 +1258,7 @@ void page_add_new_anon_rmap(struct page *page,
|
||||||
/* increment count (starts at -1) */
|
/* increment count (starts at -1) */
|
||||||
atomic_set(&page->_mapcount, 0);
|
atomic_set(&page->_mapcount, 0);
|
||||||
}
|
}
|
||||||
__mod_zone_page_state(page_zone(page), NR_ANON_PAGES, nr);
|
__mod_node_page_state(page_pgdat(page), NR_ANON_PAGES, nr);
|
||||||
__page_set_anon_rmap(page, vma, address, 1);
|
__page_set_anon_rmap(page, vma, address, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1293,7 +1293,7 @@ void page_add_file_rmap(struct page *page, bool compound)
|
||||||
if (!atomic_inc_and_test(&page->_mapcount))
|
if (!atomic_inc_and_test(&page->_mapcount))
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
__mod_zone_page_state(page_zone(page), NR_FILE_MAPPED, nr);
|
__mod_node_page_state(page_pgdat(page), NR_FILE_MAPPED, nr);
|
||||||
mem_cgroup_inc_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED);
|
mem_cgroup_inc_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED);
|
||||||
out:
|
out:
|
||||||
unlock_page_memcg(page);
|
unlock_page_memcg(page);
|
||||||
|
@ -1329,11 +1329,11 @@ static void page_remove_file_rmap(struct page *page, bool compound)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We use the irq-unsafe __{inc|mod}_zone_page_stat because
|
* We use the irq-unsafe __{inc|mod}_zone_page_state because
|
||||||
* these counters are not modified in interrupt context, and
|
* these counters are not modified in interrupt context, and
|
||||||
* pte lock(a spinlock) is held, which implies preemption disabled.
|
* pte lock(a spinlock) is held, which implies preemption disabled.
|
||||||
*/
|
*/
|
||||||
__mod_zone_page_state(page_zone(page), NR_FILE_MAPPED, -nr);
|
__mod_node_page_state(page_pgdat(page), NR_FILE_MAPPED, -nr);
|
||||||
mem_cgroup_dec_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED);
|
mem_cgroup_dec_page_stat(page, MEM_CGROUP_STAT_FILE_MAPPED);
|
||||||
|
|
||||||
if (unlikely(PageMlocked(page)))
|
if (unlikely(PageMlocked(page)))
|
||||||
|
@ -1375,7 +1375,7 @@ static void page_remove_anon_compound_rmap(struct page *page)
|
||||||
clear_page_mlock(page);
|
clear_page_mlock(page);
|
||||||
|
|
||||||
if (nr) {
|
if (nr) {
|
||||||
__mod_zone_page_state(page_zone(page), NR_ANON_PAGES, -nr);
|
__mod_node_page_state(page_pgdat(page), NR_ANON_PAGES, -nr);
|
||||||
deferred_split_huge_page(page);
|
deferred_split_huge_page(page);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1404,7 +1404,7 @@ void page_remove_rmap(struct page *page, bool compound)
|
||||||
* these counters are not modified in interrupt context, and
|
* these counters are not modified in interrupt context, and
|
||||||
* pte lock(a spinlock) is held, which implies preemption disabled.
|
* pte lock(a spinlock) is held, which implies preemption disabled.
|
||||||
*/
|
*/
|
||||||
__dec_zone_page_state(page, NR_ANON_PAGES);
|
__dec_node_page_state(page, NR_ANON_PAGES);
|
||||||
|
|
||||||
if (unlikely(PageMlocked(page)))
|
if (unlikely(PageMlocked(page)))
|
||||||
clear_page_mlock(page);
|
clear_page_mlock(page);
|
||||||
|
|
|
@ -3589,7 +3589,7 @@ int sysctl_min_slab_ratio = 5;
|
||||||
|
|
||||||
static inline unsigned long zone_unmapped_file_pages(struct zone *zone)
|
static inline unsigned long zone_unmapped_file_pages(struct zone *zone)
|
||||||
{
|
{
|
||||||
unsigned long file_mapped = zone_page_state(zone, NR_FILE_MAPPED);
|
unsigned long file_mapped = node_page_state(zone->zone_pgdat, NR_FILE_MAPPED);
|
||||||
unsigned long file_lru = node_page_state(zone->zone_pgdat, NR_INACTIVE_FILE) +
|
unsigned long file_lru = node_page_state(zone->zone_pgdat, NR_INACTIVE_FILE) +
|
||||||
node_page_state(zone->zone_pgdat, NR_ACTIVE_FILE);
|
node_page_state(zone->zone_pgdat, NR_ACTIVE_FILE);
|
||||||
|
|
||||||
|
|
|
@ -925,8 +925,6 @@ const char * const vmstat_text[] = {
|
||||||
"nr_zone_anon_lru",
|
"nr_zone_anon_lru",
|
||||||
"nr_zone_file_lru",
|
"nr_zone_file_lru",
|
||||||
"nr_mlock",
|
"nr_mlock",
|
||||||
"nr_anon_pages",
|
|
||||||
"nr_mapped",
|
|
||||||
"nr_file_pages",
|
"nr_file_pages",
|
||||||
"nr_dirty",
|
"nr_dirty",
|
||||||
"nr_writeback",
|
"nr_writeback",
|
||||||
|
@ -970,6 +968,8 @@ const char * const vmstat_text[] = {
|
||||||
"workingset_refault",
|
"workingset_refault",
|
||||||
"workingset_activate",
|
"workingset_activate",
|
||||||
"workingset_nodereclaim",
|
"workingset_nodereclaim",
|
||||||
|
"nr_anon_pages",
|
||||||
|
"nr_mapped",
|
||||||
|
|
||||||
/* enum writeback_stat_item counters */
|
/* enum writeback_stat_item counters */
|
||||||
"nr_dirty_threshold",
|
"nr_dirty_threshold",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue