linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: fix dubious code in __count_immobile_pages()
@ 2011-02-18  1:46 Namhyung Kim
  2011-02-18  2:26 ` Minchan Kim
  2011-02-21  9:57 ` KAMEZAWA Hiroyuki
  0 siblings, 2 replies; 4+ messages in thread
From: Namhyung Kim @ 2011-02-18  1:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-mm, linux-kernel, KAMEZAWA Hiroyuki

When pfn_valid_within() failed 'iter' was incremented twice.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
---
 mm/page_alloc.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e8b02771ccea..bf83d1c1d648 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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))
-- 
1.7.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: fix dubious code in __count_immobile_pages()
  2011-02-18  1:46 [PATCH] mm: fix dubious code in __count_immobile_pages() Namhyung Kim
@ 2011-02-18  2:26 ` Minchan Kim
  2011-02-18  3:00   ` Namhyung Kim
  2011-02-21  9:57 ` KAMEZAWA Hiroyuki
  1 sibling, 1 reply; 4+ messages in thread
From: Minchan Kim @ 2011-02-18  2:26 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Andrew Morton, linux-mm, linux-kernel, KAMEZAWA Hiroyuki

On Fri, Feb 18, 2011 at 10:46 AM, Namhyung Kim <namhyung@gmail.com> wrote:
> When pfn_valid_within() failed 'iter' was incremented twice.
>
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>

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!

-- 
Kind regards,
Minchan Kim

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: fix dubious code in __count_immobile_pages()
  2011-02-18  2:26 ` Minchan Kim
@ 2011-02-18  3:00   ` Namhyung Kim
  0 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2011-02-18  3:00 UTC (permalink / raw)
  To: Minchan Kim; +Cc: Andrew Morton, linux-mm, linux-kernel, KAMEZAWA Hiroyuki

2011-02-18 (e,?), 11:26 +0900, Minchan Kim:
> On Fri, Feb 18, 2011 at 10:46 AM, Namhyung Kim <namhyung@gmail.com> wrote:
> > When pfn_valid_within() failed 'iter' was incremented twice.
> >
> > Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> > Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
> 
> 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!
> 

Hi Minchan,

Either is fine to me. But I think current code would be shorter.


-- 
Regards,
Namhyung Kim


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mm: fix dubious code in __count_immobile_pages()
  2011-02-18  1:46 [PATCH] mm: fix dubious code in __count_immobile_pages() Namhyung Kim
  2011-02-18  2:26 ` Minchan Kim
@ 2011-02-21  9:57 ` KAMEZAWA Hiroyuki
  1 sibling, 0 replies; 4+ messages in thread
From: KAMEZAWA Hiroyuki @ 2011-02-21  9:57 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Andrew Morton, linux-mm, linux-kernel

On Fri, 18 Feb 2011 10:46:26 +0900
Namhyung Kim <namhyung@gmail.com> wrote:

> When pfn_valid_within() failed 'iter' was incremented twice.
> 
> Signed-off-by: Namhyung Kim <namhyung@gmail.com>
> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>

Thank you.
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>


> ---
>  mm/page_alloc.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index e8b02771ccea..bf83d1c1d648 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -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))
> -- 
> 1.7.4
> 
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  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:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-02-21 10:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-18  1:46 [PATCH] mm: fix dubious code in __count_immobile_pages() Namhyung Kim
2011-02-18  2:26 ` Minchan Kim
2011-02-18  3:00   ` Namhyung Kim
2011-02-21  9:57 ` KAMEZAWA Hiroyuki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).