Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm: move vmscan writes and file write accounting to the node

As reclaim is now node-based, it follows that page write activity due to
page reclaim should also be accounted for on the node. For consistency,
also account page writes and page dirtying on a per-node basis.

After this patch, there are a few remaining zone counters that may appear
strange but are fine. NUMA stats are still per-zone as this is a
user-space interface that tools consume. NR_MLOCK, NR_SLAB_*,
NR_PAGETABLE, NR_KERNEL_STACK and NR_BOUNCE are all allocations that
potentially pin low memory and cannot trivially be reclaimed on demand.
This information is still useful for debugging a page allocation failure
warning.

Link: http://lkml.kernel.org/r/1467970510-21195-21-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>

authored by

Mel Gorman and committed by
Linus Torvalds
c4a25635 11fb9989

+15 -15
+4 -4
include/linux/mmzone.h
··· 122 122 NR_KERNEL_STACK, 123 123 /* Second 128 byte cacheline */ 124 124 NR_BOUNCE, 125 - NR_VMSCAN_WRITE, 126 - NR_VMSCAN_IMMEDIATE, /* Prioritise for reclaim when writeback ends */ 127 - NR_DIRTIED, /* page dirtyings since bootup */ 128 - NR_WRITTEN, /* page writings since bootup */ 129 125 #if IS_ENABLED(CONFIG_ZSMALLOC) 130 126 NR_ZSPAGES, /* allocated in zsmalloc */ 131 127 #endif ··· 161 165 NR_SHMEM_PMDMAPPED, 162 166 NR_ANON_THPS, 163 167 NR_UNSTABLE_NFS, /* NFS unstable pages */ 168 + NR_VMSCAN_WRITE, 169 + NR_VMSCAN_IMMEDIATE, /* Prioritise for reclaim when writeback ends */ 170 + NR_DIRTIED, /* page dirtyings since bootup */ 171 + NR_WRITTEN, /* page writings since bootup */ 164 172 NR_VM_NODE_STAT_ITEMS 165 173 }; 166 174
+2 -2
include/trace/events/writeback.h
··· 415 415 __entry->nr_dirty = global_node_page_state(NR_FILE_DIRTY); 416 416 __entry->nr_writeback = global_node_page_state(NR_WRITEBACK); 417 417 __entry->nr_unstable = global_node_page_state(NR_UNSTABLE_NFS); 418 - __entry->nr_dirtied = global_page_state(NR_DIRTIED); 419 - __entry->nr_written = global_page_state(NR_WRITTEN); 418 + __entry->nr_dirtied = global_node_page_state(NR_DIRTIED); 419 + __entry->nr_written = global_node_page_state(NR_WRITTEN); 420 420 __entry->background_thresh = background_thresh; 421 421 __entry->dirty_thresh = dirty_thresh; 422 422 __entry->dirty_limit = global_wb_domain.dirty_limit;
+3 -3
mm/page-writeback.c
··· 2461 2461 mem_cgroup_inc_page_stat(page, MEM_CGROUP_STAT_DIRTY); 2462 2462 __inc_node_page_state(page, NR_FILE_DIRTY); 2463 2463 __inc_zone_page_state(page, NR_ZONE_WRITE_PENDING); 2464 - __inc_zone_page_state(page, NR_DIRTIED); 2464 + __inc_node_page_state(page, NR_DIRTIED); 2465 2465 __inc_wb_stat(wb, WB_RECLAIMABLE); 2466 2466 __inc_wb_stat(wb, WB_DIRTIED); 2467 2467 task_io_account_write(PAGE_SIZE); ··· 2550 2550 2551 2551 wb = unlocked_inode_to_wb_begin(inode, &locked); 2552 2552 current->nr_dirtied--; 2553 - dec_zone_page_state(page, NR_DIRTIED); 2553 + dec_node_page_state(page, NR_DIRTIED); 2554 2554 dec_wb_stat(wb, WB_DIRTIED); 2555 2555 unlocked_inode_to_wb_end(inode, locked); 2556 2556 } ··· 2787 2787 mem_cgroup_dec_page_stat(page, MEM_CGROUP_STAT_WRITEBACK); 2788 2788 dec_node_page_state(page, NR_WRITEBACK); 2789 2789 dec_zone_page_state(page, NR_ZONE_WRITE_PENDING); 2790 - inc_zone_page_state(page, NR_WRITTEN); 2790 + inc_node_page_state(page, NR_WRITTEN); 2791 2791 } 2792 2792 unlock_page_memcg(page); 2793 2793 return ret;
+2 -2
mm/vmscan.c
··· 612 612 ClearPageReclaim(page); 613 613 } 614 614 trace_mm_vmscan_writepage(page); 615 - inc_zone_page_state(page, NR_VMSCAN_WRITE); 615 + inc_node_page_state(page, NR_VMSCAN_WRITE); 616 616 return PAGE_SUCCESS; 617 617 } 618 618 ··· 1117 1117 * except we already have the page isolated 1118 1118 * and know it's dirty 1119 1119 */ 1120 - inc_zone_page_state(page, NR_VMSCAN_IMMEDIATE); 1120 + inc_node_page_state(page, NR_VMSCAN_IMMEDIATE); 1121 1121 SetPageReclaim(page); 1122 1122 1123 1123 goto keep_locked;
+4 -4
mm/vmstat.c
··· 931 931 "nr_page_table_pages", 932 932 "nr_kernel_stack", 933 933 "nr_bounce", 934 - "nr_vmscan_write", 935 - "nr_vmscan_immediate_reclaim", 936 - "nr_dirtied", 937 - "nr_written", 938 934 #if IS_ENABLED(CONFIG_ZSMALLOC) 939 935 "nr_zspages", 940 936 #endif ··· 967 971 "nr_shmem_pmdmapped", 968 972 "nr_anon_transparent_hugepages", 969 973 "nr_unstable", 974 + "nr_vmscan_write", 975 + "nr_vmscan_immediate_reclaim", 976 + "nr_dirtied", 977 + "nr_written", 970 978 971 979 /* enum writeback_stat_item counters */ 972 980 "nr_dirty_threshold",