Skip to contentSkip to conversation

mm, vmscan: Make kswapd think of reclaim in terms of nodes

PATCH Hillf Danton 2 participants 2 messages Jun 12, 2015 – Jun 15, 2015 Memory management

lore
Share & tools
lore
#0 lore raw

Review

Quoted 5 lines
(quoted diff) +3 -2
-	/* Reclaim above the high watermark. */
-	sc->nr_to_reclaim = max(SWAP_CLUSTER_MAX, high_wmark_pages(zone));
+	/* Aim to reclaim above all the zone high watermarks */
+	for (z = 0; z <= end_zone; z++) {
+		zone = pgdat->node_zones + end_zone;

s/end_zone/z/ ?

Quoted 2 lines
(quoted diff) +1 -0
+		nr_to_reclaim += high_wmark_pages(zone);

[...]

Quoted 4 lines
(quoted diff) +0 -0
@@ -3280,13 +3177,26 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
 			compact_pgdat(pgdat, order);
 
 		/*

Review static unsigned long balance_pgdat(pg_data_t *pgdat, int order, · line 3189

Quoted 10 lines
(quoted diff) +10 -0
+		 * Stop reclaiming if any eligible zone is balanced and clear
+		 * node writeback or congested.
+		 */
+		for (i = 0; i <= *classzone_idx; i++) {
+			zone = pgdat->node_zones + i;
+
+			if (zone_balanced(zone, sc.order, 0, *classzone_idx)) {
+				clear_bit(PGDAT_CONGESTED, &pgdat->flags);
+				clear_bit(PGDAT_DIRTY, &pgdat->flags);
+				break;

s/break/goto out/ ?

Quoted 16 lines
(quoted diff) +5 -3
+			}
+		}
+
+		/*
 		 * Raise priority if scanning rate is too low or there was no
 		 * progress in reclaiming pages
 		 */
 		if (raise_priority || !sc.nr_reclaimed)
 			sc.priority--;
-	} while (sc.priority >= 1 &&
-		 !pgdat_balanced(pgdat, order, *classzone_idx));
+	} while (sc.priority >= 1);
 
 out:
 	/*
--
Quoted 1 line

2.3.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 6 lines · Hillf Danton

Review

Quoted 5 lines
(quoted diff) +3 -2
-	/* Reclaim above the high watermark. */
-	sc->nr_to_reclaim = max(SWAP_CLUSTER_MAX, high_wmark_pages(zone));
+	/* Aim to reclaim above all the zone high watermarks */
+	for (z = 0; z <= end_zone; z++) {
+		zone = pgdat->node_zones + end_zone;

s/end_zone/z/ ?

Ouch, thanks!

With this bug, kswapd would reclaim based on a multiple of the highest zone. Whether that was under or over reclaim would depend on the size of that zone relative to lower zones.

Quoted 6 lines
Quoted 2 lines
(quoted diff) +1 -0
+		nr_to_reclaim += high_wmark_pages(zone);

[...]

Quoted 3 lines
(quoted diff) +0 -0
@@ -3280,13 +3177,26 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
 			compact_pgdat(pgdat, order);
 
Quoted 12 lines

Review static unsigned long balance_pgdat(pg_data_t *pgdat, int order, · line 3189

Quoted 11 lines
(quoted diff) +10 -0
 		/*
+		 * Stop reclaiming if any eligible zone is balanced and clear
+		 * node writeback or congested.
+		 */
+		for (i = 0; i <= *classzone_idx; i++) {
+			zone = pgdat->node_zones + i;
+
+			if (zone_balanced(zone, sc.order, 0, *classzone_idx)) {
+				clear_bit(PGDAT_CONGESTED, &pgdat->flags);
+				clear_bit(PGDAT_DIRTY, &pgdat->flags);
+				break;

s/break/goto out/ ?

Yes. It'd actually be ok because it'll detect the same condition and exit in the next outer loop but goto out is better.

Signature · 8 lines
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>