Skip to contentSkip to conversation

mm/writeback: correct dirty page calculation for highmem

PATCH New [email protected] 1 participant 1 message May 20, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 68/117 mm/writeback: correct dirty page calculation for highmem

From: Joonsoo Kim <[email protected]>
Subject: mm/writeback: correct dirty page calculation for highmem

ZONE_MOVABLE could be treated as highmem so we need to consider it for accurate calculation of dirty pages. And, in following patches, ZONE_CMA will be introduced and it can be treated as highmem, too. So, instead of manually adding stat of ZONE_MOVABLE, looping all zones and check whether the zone is highmem or not and add stat of the zone which can be treated as highmem.

Cc Rik van Riel <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Laura Abbott <[email protected]>
Cc Minchan Kim <[email protected]>
Cc Marek Szyprowski <[email protected]>
Cc Michal Nazarewicz <[email protected]>
Cc Vlastimil Babka <[email protected]>

---

 mm/page-writeback.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
mm/page-writeback.c renamed from mm/page-writeback.c~mm-writeback-correct-dirty-page-calculation-for-highmem +6 -2
diff -puN mm/page-writeback.c~mm-writeback-correct-dirty-page-calculation-for-highmem mm/page-writeback.c
@@ -296,11 +296,15 @@ static unsigned long highmem_dirtyable_m
 #ifdef CONFIG_HIGHMEM
 	int node;
 	unsigned long x = 0;
+	int i;
 
 	for_each_node_state(node, N_HIGH_MEMORY) {
-		struct zone *z = &NODE_DATA(node)->node_zones[ZONE_HIGHMEM];
+		for (i = 0; i < MAX_NR_ZONES; i++) {
+			struct zone *z = &NODE_DATA(node)->node_zones[i];
 
-		x += zone_dirtyable_memory(z);
+			if (is_highmem(z))
+				x += zone_dirtyable_memory(z);
+		}
 	}
 	/*
 	 * Unreclaimable memory (kernel memory or anonymous memory

_