mm, page_alloc: consider dirtyable memory in terms of nodes
Subsystems (5)
[email protected]
maintainerPATCH 33/101 mm, page_alloc: consider dirtyable memory in terms of nodes
From: Mel Gorman <[email protected]>
Subject: mm, page_alloc: consider dirtyable memory in terms of nodes
Historically dirty pages were spread among zones but now that LRUs are per-node it is more appropriate to consider dirty pages in a node.
Signed-off-by Mel Gorman <[email protected]>
Signed-off-by Johannes Weiner <[email protected]>
Acked-by Vlastimil Babka <[email protected]>
Acked-by Michal Hocko <[email protected]>
Cc Hillf Danton <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Rik van Riel <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
include/linux/mmzone.h | 12 ++-- include/linux/writeback.h | 2 mm/page-writeback.c | 91 ++++++++++++++++++++++++------------ mm/page_alloc.c | 26 ++++------ 4 files changed, 79 insertions(+), 52 deletions(-)
include/linux/mmzone.h renamed from include/linux/mmzone.h~mm-page_alloc-consider-dirtyable-memory-in-terms-of-nodes +6 -6
@@ -363,12 +363,6 @@ struct zone {struct pglist_data *zone_pgdat;struct per_cpu_pageset __percpu *pageset; -/* -* This is a per-zone reserve of pages that are not available -* to userspace allocations. -*/ -unsigned long totalreserve_pages; -#ifndef CONFIG_SPARSEMEM /* * Flags for a pageblock_nr_pages block. See pageblock-flags.h.
@@ -687,6 +681,12 @@ typedef struct pglist_data {/* Number of pages migrated during the rate limiting time interval */ unsigned long numabalancing_migrate_nr_pages;#endif +/* +* This is a per-node reserve of pages that are not available +* to userspace allocations. +*/ +unsigned long totalreserve_pages; +/* Write-intensive fields used by page reclaim */ ZONE_PADDING (_pad1_) spinlock_t lru_lock;
include/linux/writeback.h renamed from include/linux/writeback.h~mm-page_alloc-consider-dirtyable-memory-in-terms-of-nodes +1 -1
@@ -320,7 +320,7 @@ void laptop_mode_timer_fn(unsigned longstatic inline void laptop_sync_completion (void ) { }#endif void throttle_vm_writeout (gfp_t gfp_mask); -bool zone_dirty_ok (struct zone *zone); +bool node_dirty_ok (struct pglist_data *pgdat);int wb_domain_init (struct wb_domain *dom,gfp_t gfp);#ifdef CONFIG_CGROUP_WRITEBACK void wb_domain_exit (struct wb_domain *dom);
mm/page-writeback.c renamed from mm/page-writeback.c~mm-page_alloc-consider-dirtyable-memory-in-terms-of-nodes +61 -30
142 lines not on this page · raw message
mm/page_alloc.c renamed from mm/page_alloc.c~mm-page_alloc-consider-dirtyable-memory-in-terms-of-nodes +11 -15
@@ -2912,31 +2912,24 @@ zonelist_scan: }/* * When allocating a page cache page for writing, we -* want to get it from a zone that is within its dirty -* limit, such that no single zone holds more than its +* want to get it from a node that is within its dirty +* limit, such that no single node holds more than its * proportional share of globally allowed dirty pages. -* The dirty limits take into account the zone's +* The dirty limits take into account the node's * lowmem reserves and high watermark so that kswapd * should be able to balance it without having to * write pages from its LRU list. * -* This may look like it could increase pressure on -* lower zones by failing allocations in higher zones -* before they are full. But the pages that do spill -* over are limited as the lower zones are protected -* by this very same mechanism. It should not become -* a practical burden to them. -* * XXX: For now, allow allocations to potentially -* exceed the per-zone dirty limit in the slowpath +* exceed the per-node dirty limit in the slowpath * (spread_dirty_pages unset) before going into reclaim, * which is important when on a NUMA setup the allowed -* zones are together not big enough to reach the +* nodes are together not big enough to reach the * global limit. The proper fix for these situations -* will require awareness of zones in the +* will require awareness of nodes in the * dirty-throttling and the flusher threads. */ -if (ac->spread_dirty_pages && !zone_dirty_ok (zone)) +if (ac->spread_dirty_pages && !node_dirty_ok (zone->zone_pgdat))continue ; mark = zone->watermark[alloc_flags &ALLOC_WMARK_MASK ];
@@ -6701,6 +6694,9 @@ static void calculate_totalreserve_pagesenum zone_type i, j;for_each_online_pgdat (pgdat) { + + pgdat->totalreserve_pages =0 ; +for (i =0 ; i <MAX_NR_ZONES ; i++) {struct zone *zone = pgdat->node_zones + i;long max =0 ;
@@ -6717,7 +6713,7 @@ static void calculate_totalreserve_pagesif (max > zone->managed_pages) max = zone->managed_pages; - zone->totalreserve_pages = max; + pgdat->totalreserve_pages += max; reserve_pages += max; }
_