Skip to contentSkip to conversation

mm:vmscan:replace zone_watermark_ok with zone_balanced for determining if kswapd will call compaction

PATCH In review Chen Yucong 2 participants 2 messages Jun 22, 2014 – Jun 23, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm:vmscan:replace zone_watermark_ok with zone_balanced for determining if kswapd will call compaction

According to the commit messages of "mm: vmscan: fix endless loop in kswapd balancing" and "mm: vmscan: decide whether to compact the pgdat based on reclaim progress", minor change is required to the following snippet.

        /*
         * If any zone is currently balanced then kswapd will
         * not call compaction as it is expected that the
         * necessary pages are already available.
         */
        if (pgdat_needs_compaction &&
                zone_watermark_ok(zone, order,
                                        low_wmark_pages(zone),
                                        *classzone_idx, 0))
                pgdat_needs_compaction = false;

zone_watermark_ok() should be replaced by zone_balanced() in the above snippet. That's because zone_balanced() is more suitable for the context.

---
 mm/vmscan.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
mm/vmscan.c +2 -3
index a8ffe4e..e1004ad 100644
@@ -3157,9 +3157,8 @@ static unsigned long balance_pgdat(pg_data_t *pgdat, int order,
 			 * necessary pages are already available.
 			 */
 			if (pgdat_needs_compaction &&
-					zone_watermark_ok(zone, order,
-						low_wmark_pages(zone),
-						*classzone_idx, 0))
+					zone_balanced(zone, order, 0,
+						*classzone_idx))
 				pgdat_needs_compaction = false;
 		}
 
Signature · 7 lines
1.7.10.4

--
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 15 lines · Chen Yucong

According to the commit messages of "mm: vmscan: fix endless loop in kswapd balancing" and "mm: vmscan: decide whether to compact the pgdat based on reclaim progress", minor change is required to the following snippet.

        /*
         * If any zone is currently balanced then kswapd will
         * not call compaction as it is expected that the
         * necessary pages are already available.
         */
        if (pgdat_needs_compaction &&
                zone_watermark_ok(zone, order,
                                        low_wmark_pages(zone),
                                        *classzone_idx, 0))
                pgdat_needs_compaction = false;
Quoted 3 lines

zone_watermark_ok() should be replaced by zone_balanced() in the above snippet. That's because zone_balanced() is more suitable for the context.

What bug does this fix?

The intent here is to prevent kswapd compacting a node if an allocation request within that node would succeed against the low watermark. Your change alters that to check against hte high watermark + balance gap without explaining why kswapd should compact until the high watermark is reached.

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>