mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 15:27:29 +00:00
mm: move most file-based accounting to the node
There are now a number of accounting oddities such as mapped file pages being accounted for on the node while the total number of file pages are accounted on the zone. This can be coped with to some extent but it's confusing so this patch moves the relevant file-based accounted. Due to throttling logic in the page allocator for reliable OOM detection, it is still necessary to track dirty and writeback pages on a per-zone basis. [mgorman@techsingularity.net: fix NR_ZONE_WRITE_PENDING accounting] Link: http://lkml.kernel.org/r/1468404004-5085-5-git-send-email-mgorman@techsingularity.net Link: http://lkml.kernel.org/r/1467970510-21195-20-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
4b9d0fab71
commit
11fb998986
24 changed files with 155 additions and 162 deletions
|
@ -3492,14 +3492,12 @@ should_reclaim_retry(gfp_t gfp_mask, unsigned order,
|
|||
* prevent from pre mature OOM
|
||||
*/
|
||||
if (!did_some_progress) {
|
||||
unsigned long writeback;
|
||||
unsigned long dirty;
|
||||
unsigned long write_pending;
|
||||
|
||||
writeback = zone_page_state_snapshot(zone,
|
||||
NR_WRITEBACK);
|
||||
dirty = zone_page_state_snapshot(zone, NR_FILE_DIRTY);
|
||||
write_pending = zone_page_state_snapshot(zone,
|
||||
NR_ZONE_WRITE_PENDING);
|
||||
|
||||
if (2*(writeback + dirty) > reclaimable) {
|
||||
if (2 * write_pending > reclaimable) {
|
||||
congestion_wait(BLK_RW_ASYNC, HZ/10);
|
||||
return true;
|
||||
}
|
||||
|
@ -4175,7 +4173,7 @@ EXPORT_SYMBOL_GPL(si_mem_available);
|
|||
void si_meminfo(struct sysinfo *val)
|
||||
{
|
||||
val->totalram = totalram_pages;
|
||||
val->sharedram = global_page_state(NR_SHMEM);
|
||||
val->sharedram = global_node_page_state(NR_SHMEM);
|
||||
val->freeram = global_page_state(NR_FREE_PAGES);
|
||||
val->bufferram = nr_blockdev_pages();
|
||||
val->totalhigh = totalhigh_pages;
|
||||
|
@ -4197,7 +4195,7 @@ void si_meminfo_node(struct sysinfo *val, int nid)
|
|||
for (zone_type = 0; zone_type < MAX_NR_ZONES; zone_type++)
|
||||
managed_pages += pgdat->node_zones[zone_type].managed_pages;
|
||||
val->totalram = managed_pages;
|
||||
val->sharedram = sum_zone_node_page_state(nid, NR_SHMEM);
|
||||
val->sharedram = node_page_state(pgdat, NR_SHMEM);
|
||||
val->freeram = sum_zone_node_page_state(nid, NR_FREE_PAGES);
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
for (zone_type = 0; zone_type < MAX_NR_ZONES; zone_type++) {
|
||||
|
@ -4296,9 +4294,6 @@ void show_free_areas(unsigned int filter)
|
|||
" unevictable:%lu dirty:%lu writeback:%lu unstable:%lu\n"
|
||||
" slab_reclaimable:%lu slab_unreclaimable:%lu\n"
|
||||
" mapped:%lu shmem:%lu pagetables:%lu bounce:%lu\n"
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
" anon_thp: %lu shmem_thp: %lu shmem_pmdmapped: %lu\n"
|
||||
#endif
|
||||
" free:%lu free_pcp:%lu free_cma:%lu\n",
|
||||
global_node_page_state(NR_ACTIVE_ANON),
|
||||
global_node_page_state(NR_INACTIVE_ANON),
|
||||
|
@ -4307,20 +4302,15 @@ void show_free_areas(unsigned int filter)
|
|||
global_node_page_state(NR_INACTIVE_FILE),
|
||||
global_node_page_state(NR_ISOLATED_FILE),
|
||||
global_node_page_state(NR_UNEVICTABLE),
|
||||
global_page_state(NR_FILE_DIRTY),
|
||||
global_page_state(NR_WRITEBACK),
|
||||
global_page_state(NR_UNSTABLE_NFS),
|
||||
global_node_page_state(NR_FILE_DIRTY),
|
||||
global_node_page_state(NR_WRITEBACK),
|
||||
global_node_page_state(NR_UNSTABLE_NFS),
|
||||
global_page_state(NR_SLAB_RECLAIMABLE),
|
||||
global_page_state(NR_SLAB_UNRECLAIMABLE),
|
||||
global_node_page_state(NR_FILE_MAPPED),
|
||||
global_page_state(NR_SHMEM),
|
||||
global_node_page_state(NR_SHMEM),
|
||||
global_page_state(NR_PAGETABLE),
|
||||
global_page_state(NR_BOUNCE),
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
global_page_state(NR_ANON_THPS) * HPAGE_PMD_NR,
|
||||
global_page_state(NR_SHMEM_THPS) * HPAGE_PMD_NR,
|
||||
global_page_state(NR_SHMEM_PMDMAPPED) * HPAGE_PMD_NR,
|
||||
#endif
|
||||
global_page_state(NR_FREE_PAGES),
|
||||
free_pcp,
|
||||
global_page_state(NR_FREE_CMA_PAGES));
|
||||
|
@ -4335,6 +4325,16 @@ void show_free_areas(unsigned int filter)
|
|||
" isolated(anon):%lukB"
|
||||
" isolated(file):%lukB"
|
||||
" mapped:%lukB"
|
||||
" dirty:%lukB"
|
||||
" writeback:%lukB"
|
||||
" shmem:%lukB"
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
" shmem_thp: %lukB"
|
||||
" shmem_pmdmapped: %lukB"
|
||||
" anon_thp: %lukB"
|
||||
#endif
|
||||
" writeback_tmp:%lukB"
|
||||
" unstable:%lukB"
|
||||
" all_unreclaimable? %s"
|
||||
"\n",
|
||||
pgdat->node_id,
|
||||
|
@ -4346,6 +4346,17 @@ void show_free_areas(unsigned int filter)
|
|||
K(node_page_state(pgdat, NR_ISOLATED_ANON)),
|
||||
K(node_page_state(pgdat, NR_ISOLATED_FILE)),
|
||||
K(node_page_state(pgdat, NR_FILE_MAPPED)),
|
||||
K(node_page_state(pgdat, NR_FILE_DIRTY)),
|
||||
K(node_page_state(pgdat, NR_WRITEBACK)),
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
K(node_page_state(pgdat, NR_SHMEM_THPS) * HPAGE_PMD_NR),
|
||||
K(node_page_state(pgdat, NR_SHMEM_PMDMAPPED)
|
||||
* HPAGE_PMD_NR),
|
||||
K(node_page_state(pgdat, NR_ANON_THPS) * HPAGE_PMD_NR),
|
||||
#endif
|
||||
K(node_page_state(pgdat, NR_SHMEM)),
|
||||
K(node_page_state(pgdat, NR_WRITEBACK_TEMP)),
|
||||
K(node_page_state(pgdat, NR_UNSTABLE_NFS)),
|
||||
!pgdat_reclaimable(pgdat) ? "yes" : "no");
|
||||
}
|
||||
|
||||
|
@ -4368,24 +4379,14 @@ void show_free_areas(unsigned int filter)
|
|||
" present:%lukB"
|
||||
" managed:%lukB"
|
||||
" mlocked:%lukB"
|
||||
" dirty:%lukB"
|
||||
" writeback:%lukB"
|
||||
" shmem:%lukB"
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
" shmem_thp: %lukB"
|
||||
" shmem_pmdmapped: %lukB"
|
||||
" anon_thp: %lukB"
|
||||
#endif
|
||||
" slab_reclaimable:%lukB"
|
||||
" slab_unreclaimable:%lukB"
|
||||
" kernel_stack:%lukB"
|
||||
" pagetables:%lukB"
|
||||
" unstable:%lukB"
|
||||
" bounce:%lukB"
|
||||
" free_pcp:%lukB"
|
||||
" local_pcp:%ukB"
|
||||
" free_cma:%lukB"
|
||||
" writeback_tmp:%lukB"
|
||||
" node_pages_scanned:%lu"
|
||||
"\n",
|
||||
zone->name,
|
||||
|
@ -4396,26 +4397,15 @@ void show_free_areas(unsigned int filter)
|
|||
K(zone->present_pages),
|
||||
K(zone->managed_pages),
|
||||
K(zone_page_state(zone, NR_MLOCK)),
|
||||
K(zone_page_state(zone, NR_FILE_DIRTY)),
|
||||
K(zone_page_state(zone, NR_WRITEBACK)),
|
||||
K(zone_page_state(zone, NR_SHMEM)),
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
K(zone_page_state(zone, NR_SHMEM_THPS) * HPAGE_PMD_NR),
|
||||
K(zone_page_state(zone, NR_SHMEM_PMDMAPPED)
|
||||
* HPAGE_PMD_NR),
|
||||
K(zone_page_state(zone, NR_ANON_THPS) * HPAGE_PMD_NR),
|
||||
#endif
|
||||
K(zone_page_state(zone, NR_SLAB_RECLAIMABLE)),
|
||||
K(zone_page_state(zone, NR_SLAB_UNRECLAIMABLE)),
|
||||
zone_page_state(zone, NR_KERNEL_STACK) *
|
||||
THREAD_SIZE / 1024,
|
||||
K(zone_page_state(zone, NR_PAGETABLE)),
|
||||
K(zone_page_state(zone, NR_UNSTABLE_NFS)),
|
||||
K(zone_page_state(zone, NR_BOUNCE)),
|
||||
K(free_pcp),
|
||||
K(this_cpu_read(zone->pageset->pcp.count)),
|
||||
K(zone_page_state(zone, NR_FREE_CMA_PAGES)),
|
||||
K(zone_page_state(zone, NR_WRITEBACK_TEMP)),
|
||||
K(node_page_state(zone->zone_pgdat, NR_PAGES_SCANNED)));
|
||||
printk("lowmem_reserve[]:");
|
||||
for (i = 0; i < MAX_NR_ZONES; i++)
|
||||
|
@ -4458,7 +4448,7 @@ void show_free_areas(unsigned int filter)
|
|||
|
||||
hugetlb_show_meminfo();
|
||||
|
||||
printk("%ld total pagecache pages\n", global_page_state(NR_FILE_PAGES));
|
||||
printk("%ld total pagecache pages\n", global_node_page_state(NR_FILE_PAGES));
|
||||
|
||||
show_swap_cache_info();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue