Skip to content

Commit

Permalink
mm: fix dubious code in __count_immobile_pages()
Browse files Browse the repository at this point in the history
When pfn_valid_within() failed 'iter' was incremented twice.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Namhyung Kim authored and Linus Torvalds committed Feb 25, 2011
1 parent a2d6d2f commit 29723fc
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5376,10 +5376,9 @@ __count_immobile_pages(struct zone *zone, struct page *page, int count)
for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) {
unsigned long check = pfn + iter;

if (!pfn_valid_within(check)) {
iter++;
if (!pfn_valid_within(check))
continue;
}

page = pfn_to_page(check);
if (!page_count(page)) {
if (PageBuddy(page))
Expand Down

0 comments on commit 29723fc

Please sign in to comment.