mm/compaction.c: fix zoneindex in kcompactd()
authorChen Feng <[email protected]>
Fri, 20 May 2016 23:59:02 +0000 (16:59 -0700)
committerLinus Torvalds <[email protected]>
Sat, 21 May 2016 00:58:30 +0000 (17:58 -0700)
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.

[[email protected]: fix kcompactd_do_work() as well, per Hugh]
Link: http://lkml.kernel.org/r/[email protected]
Fixes: accf62422b3a ("mm, kswapd: replace kswapd compaction with waking up kcompactd")
Signed-off-by: Chen Feng <[email protected]>
Acked-by: Vlastimil Babka <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Kirill A. Shutemov <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Zhuangluan Su <[email protected]>
Cc: Yiping Xu <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/compaction.c

index d8a20fcf867813a431c28db846d2447cf7a82aa8..1427366ad6735acfd09ce47eb6aa2bed042b4b3c 100644 (file)
@@ -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)
                                                        cc.classzone_idx);
        count_vm_event(KCOMPACTD_WAKE);
 
-       for (zoneid = 0; zoneid < cc.classzone_idx; zoneid++) {
+       for (zoneid = 0; zoneid <= cc.classzone_idx; zoneid++) {
                int status;
 
                zone = &pgdat->node_zones[zoneid];