Re: [PATCH v2 4/5] mm, kswapd: replace kswapd compaction with waking up kcompactd
From: Vlastimil Babka
Date: Wed Mar 02 2016 - 07:27:44 EST
A fixlet for things Joonsoo caught.
----8<----
From: Vlastimil Babka <vbabka@xxxxxxx>
Date: Wed, 2 Mar 2016 11:50:16 +0100
Subject: mm-kswapd-replace-kswapd-compaction-with-waking-up-kcompactd-fix
Change zone_balanced() check in balance_pgdat() to consider only base pages
as that's the same what kswapd_shrink_zone() later does. So a zone that would
be selected due to lack of high-order pages would not be reclaimed anyway,
and just cause extra CPU churn.
Also remove unnecessary variable testorder in kswapd_shrink_zone().
Reported-by: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx>
---
mm/vmscan.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/mm/vmscan.c b/mm/vmscan.c
index b8478a737ef5..23bc7e643ad8 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3073,7 +3073,6 @@ static bool kswapd_shrink_zone(struct zone *zone,
int classzone_idx,
struct scan_control *sc)
{
- int testorder = sc->order;
unsigned long balance_gap;
bool lowmem_pressure;
@@ -3094,7 +3093,7 @@ static bool kswapd_shrink_zone(struct zone *zone,
* reclaim is necessary
*/
lowmem_pressure = (buffer_heads_over_limit && is_highmem(zone));
- if (!lowmem_pressure && zone_balanced(zone, testorder, false,
+ if (!lowmem_pressure && zone_balanced(zone, sc->order, false,
balance_gap, classzone_idx))
return true;
@@ -3109,7 +3108,7 @@ static bool kswapd_shrink_zone(struct zone *zone,
* waits.
*/
if (zone_reclaimable(zone) &&
- zone_balanced(zone, testorder, false, 0, classzone_idx)) {
+ zone_balanced(zone, sc->order, false, 0, classzone_idx)) {
clear_bit(ZONE_CONGESTED, &zone->flags);
clear_bit(ZONE_DIRTY, &zone->flags);
}
@@ -3190,7 +3189,7 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx)
break;
}
- if (!zone_balanced(zone, order, true, 0, 0)) {
+ if (!zone_balanced(zone, order, false, 0, 0)) {
end_zone = i;
break;
} else {
--
2.7.2