mm: fix dubious code in __count_immobile_pages()
Subsystems (2)
PATCH 1/1 mm: fix dubious code in __count_immobile_pages()
When pfn_valid_within() failed 'iter' was incremented twice.
--- mm/page_alloc.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
mm/page_alloc.c +2 -3
@@ -5380,10 +5380,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))
Signature · 8 lines
1.7.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 4 lines · Namhyung Kim
When
pfn_valid_within()failed 'iter' was incremented twice.Signed-off-by Namhyung Kim <[email protected]>Cc KAMEZAWA Hiroyuki <[email protected]>
Nitpick.
I am not sure it's best. I don't like below trick. iter += (1 << page_order(page)) - 1;
So we can change for loop with while as removing -1 trick of PageBuddy. But if you don't like it, I don't mind it. :)
Thanks!
Signature · 9 lines
Kind regards, Minchan Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
2011-02-18 (e,?), 11:26 +0900, Minchan Kim:
Quoted 9 lines · Namhyung Kim
Quoted 4 lines
When
pfn_valid_within()failed 'iter' was incremented twice.Signed-off-by Namhyung Kim <[email protected]>Cc KAMEZAWA Hiroyuki <[email protected]>Reviewed-by Minchan Kim <[email protected]>Nitpick.
Quoted 8 lines
I am not sure it's best. I don't like below trick. iter += (1 <<
page_order(page)) - 1;So we can change for loop with while as removing -1 trick of PageBuddy. But if you don't like it, I don't mind it. :)
Thanks!
Hi Minchan,
Either is fine to me. But I think current code would be shorter.
Signature · 10 lines
Regards, Namhyung Kim -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 4 lines · On Fri, 18 Feb 2011 10:46:26 +0900 Namhyung Kim <[email protected]> wrote:
When
pfn_valid_within()failed 'iter' was incremented twice.Signed-off-by Namhyung Kim <[email protected]>Cc KAMEZAWA Hiroyuki <[email protected]>
Thank you.
Quoted 25 lines
--- mm/page_alloc.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)mm/page_alloc.c +2
-3@@ -5380,10 +5380,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))Signature · 1 line
1.7.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>