Commit 6cd9dc3e authored by Chen Feng's avatar Chen Feng Committed by Linus Torvalds

mm/compaction.c: fix zoneindex in kcompactd()

While testing the kcompactd in my platform 3G MEM only DMA ZONE.  I
found the kcompactd never wakeup.  It seems the zoneindex has already
minus 1 before.  So the traverse here should be <=.

It fixes a regression where kswapd could previously compact, but
kcompactd not.  Not a crash fix though.

[ fix kcompactd_do_work() as well, per Hugh]
Fixes: accf6242 ("mm, kswapd: replace kswapd compaction with waking up kcompactd")
Signed-off-by: default avatarChen Feng <>
Acked-by: default avatarVlastimil Babka <>
Cc: Hugh Dickins <>
Cc: Michal Hocko <>
Cc: Kirill A. Shutemov <>
Cc: Johannes Weiner <>
Cc: Tejun Heo <>
Cc: Zhuangluan Su <>
Cc: Yiping Xu <>
Cc: <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 0bb2fd13
......@@ -1862,7 +1862,7 @@ static bool kcompactd_node_suitable(pg_data_t *pgdat)
struct zone *zone;
enum zone_type classzone_idx = pgdat->kcompactd_classzone_idx;
for (zoneid = 0; zoneid < classzone_idx; zoneid++) {
for (zoneid = 0; zoneid <= classzone_idx; zoneid++) {
zone = &pgdat->node_zones[zoneid];
if (!populated_zone(zone))
......@@ -1897,7 +1897,7 @@ static void kcompactd_do_work(pg_data_t *pgdat)
for (zoneid = 0; zoneid < cc.classzone_idx; zoneid++) {
for (zoneid = 0; zoneid <= cc.classzone_idx; zoneid++) {
int status;
zone = &pgdat->node_zones[zoneid];
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment