]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm-compaction-avoid-rescanning-pageblocks-in-isolate_freepages-fix
authorVlastimil Babka <vbabka@suse.cz>
Thu, 22 May 2014 00:43:14 +0000 (10:43 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:43:14 +0000 (10:43 +1000)
Fix a (spurious) build warning:

mm/compaction.c:860:15: warning: `next_free_pfn' may be used uninitialized in this function [-Wmaybe-uninitialized]

Seems like the compiler cannot prove that exiting the for loop without
updating next_free_pfn there will mean that the check for crossing the
scanners will trigger.  So let's not confuse people who try to see why
this warning occurs.

Instead of initializing next_free_pfn to zero with an explaining comment,
just drop the damned variable altogether and work with cc->free_pfn
directly as Nayoa originally suggested.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Suggested-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/compaction.c

index 83ca6f9138e2efdadd1c03ac093512815994821c..72f100bf42a23f897f2672f4281bd9ca79da6794 100644 (file)
@@ -685,7 +685,6 @@ static void isolate_freepages(struct zone *zone,
        unsigned long block_start_pfn;  /* start of current pageblock */
        unsigned long block_end_pfn;    /* end of current pageblock */
        unsigned long low_pfn;       /* lowest pfn scanner is able to scan */
-       unsigned long next_free_pfn; /* start pfn for scaning at next round */
        int nr_freepages = cc->nr_freepages;
        struct list_head *freelist = &cc->freepages;
 
@@ -745,7 +744,7 @@ static void isolate_freepages(struct zone *zone,
                        continue;
 
                /* Found a block suitable for isolating free pages from */
-               next_free_pfn = block_start_pfn;
+               cc->free_pfn = block_start_pfn;
                isolated = isolate_freepages_block(cc, block_start_pfn,
                                        block_end_pfn, freelist, false);
                nr_freepages += isolated;
@@ -768,9 +767,8 @@ static void isolate_freepages(struct zone *zone,
         * so that compact_finished() may detect this
         */
        if (block_start_pfn < low_pfn)
-               next_free_pfn = cc->migrate_pfn;
+               cc->free_pfn = cc->migrate_pfn;
 
-       cc->free_pfn = next_free_pfn;
        cc->nr_freepages = nr_freepages;
 }