LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [2.6 patch] mm/hugetlb.c: fix duplicate variable
@ 2008-04-14 18:14 Adrian Bunk
  0 siblings, 0 replies; 8+ messages in thread
From: Adrian Bunk @ 2008-04-14 18:14 UTC (permalink / raw)
  To: wli; +Cc: linux-kernel

It's confusing that set_max_huge_pages() contained two different 
variables named "ret", and although the code works correctly this should 
be fixed.

The inner of the two variables can simply be removed.

Spotted by sparse.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---

This patch has been sent on:
- 31 Mar 2008
- 25 Feb 2008

 mm/hugetlb.c |    1 -
 1 file changed, 1 deletion(-)

--- linux-2.6/mm/hugetlb.c.old	2008-02-24 23:17:52.000000000 +0200
+++ linux-2.6/mm/hugetlb.c	2008-02-24 23:26:07.000000000 +0200
@@ -518,45 +518,44 @@
 static unsigned long set_max_huge_pages(unsigned long count)
 {
 	unsigned long min_count, ret;
 
 	/*
 	 * Increase the pool size
 	 * First take pages out of surplus state.  Then make up the
 	 * remaining difference by allocating fresh huge pages.
 	 *
 	 * We might race with alloc_buddy_huge_page() here and be unable
 	 * to convert a surplus huge page to a normal huge page. That is
 	 * not critical, though, it just means the overall size of the
 	 * pool might be one hugepage larger than it needs to be, but
 	 * within all the constraints specified by the sysctls.
 	 */
 	spin_lock(&hugetlb_lock);
 	while (surplus_huge_pages && count > persistent_huge_pages) {
 		if (!adjust_pool_surplus(-1))
 			break;
 	}
 
 	while (count > persistent_huge_pages) {
-		int ret;
 		/*
 		 * If this allocation races such that we no longer need the
 		 * page, free_huge_page will handle it by freeing the page
 		 * and reducing the surplus.
 		 */
 		spin_unlock(&hugetlb_lock);
 		ret = alloc_fresh_huge_page();
 		spin_lock(&hugetlb_lock);
 		if (!ret)
 			goto out;
 
 	}
 
 	/*
 	 * Decrease the pool size
 	 * First return free pages to the buddy allocator (being careful
 	 * to keep enough around to satisfy reservations).  Then place
 	 * pages into surplus state as needed so the pool will shrink
 	 * to the desired size as pages become free.
 	 *
 	 * By placing pages into the surplus state independent of the
 	 * overcommit value, we are allowing the surplus pool size to

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

* Re: [2.6 patch] mm/hugetlb.c: fix duplicate variable
  2008-05-05 20:19   ` Adrian Bunk
@ 2008-05-05 20:28     ` KOSAKI Motohiro
  0 siblings, 0 replies; 8+ messages in thread
From: KOSAKI Motohiro @ 2008-05-05 20:28 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: wli, linux-kernel, Andrew Morton

>  > two?
>  > I think removal inner variable is 1, no?
>
>  Two people for whom English is not the native language are trying to
>  understand each other...  ;)
>
>  There were two variables.
>
>  And my patch removes the inner one inside the loop, not the outer one
>  that is valid within the whole function.

Ah, sorry.
I had misunderstanded.

you are right :)

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

* Re: [2.6 patch] mm/hugetlb.c: fix duplicate variable
  2008-05-05 20:11 ` KOSAKI Motohiro
@ 2008-05-05 20:19   ` Adrian Bunk
  2008-05-05 20:28     ` KOSAKI Motohiro
  0 siblings, 1 reply; 8+ messages in thread
From: Adrian Bunk @ 2008-05-05 20:19 UTC (permalink / raw)
  To: KOSAKI Motohiro; +Cc: wli, linux-kernel, Andrew Morton

On Tue, May 06, 2008 at 05:11:10AM +0900, KOSAKI Motohiro wrote:
> > It's confusing that set_max_huge_pages() contained two different
> >  variables named "ret", and although the code works correctly this should
> >  be fixed.
> >
> >  The inner of the two variables can simply be removed.
>                             ^^^^
> 
> two?
> I think removal inner variable is 1, no?

Two people for whom English is not the native language are trying to 
understand each other...  ;)

There were two variables.

And my patch removes the inner one inside the loop, not the outer one 
that is valid within the whole function.

> but, your change is perfectly right, IMHO.
> 
>            Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> 
> 
> >         while (count > persistent_huge_pages) {
> >  -               int ret;
> >                 /*
> >                  * If this allocation races such that we no longer need the
> >                  * page, free_huge_page will handle it by freeing the page
> >                  * and reducing the surplus.
> >                  */

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


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

* Re: [2.6 patch] mm/hugetlb.c: fix duplicate variable
  2008-05-05 18:28 Adrian Bunk
@ 2008-05-05 20:11 ` KOSAKI Motohiro
  2008-05-05 20:19   ` Adrian Bunk
  0 siblings, 1 reply; 8+ messages in thread
From: KOSAKI Motohiro @ 2008-05-05 20:11 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: wli, linux-kernel, Andrew Morton

> It's confusing that set_max_huge_pages() contained two different
>  variables named "ret", and although the code works correctly this should
>  be fixed.
>
>  The inner of the two variables can simply be removed.
                            ^^^^

two?
I think removal inner variable is 1, no?
but, your change is perfectly right, IMHO.

           Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>


>         while (count > persistent_huge_pages) {
>  -               int ret;
>                 /*
>                  * If this allocation races such that we no longer need the
>                  * page, free_huge_page will handle it by freeing the page
>                  * and reducing the surplus.
>                  */

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

* [2.6 patch] mm/hugetlb.c: fix duplicate variable
@ 2008-05-05 18:28 Adrian Bunk
  2008-05-05 20:11 ` KOSAKI Motohiro
  0 siblings, 1 reply; 8+ messages in thread
From: Adrian Bunk @ 2008-05-05 18:28 UTC (permalink / raw)
  To: wli; +Cc: linux-kernel, Andrew Morton

It's confusing that set_max_huge_pages() contained two different 
variables named "ret", and although the code works correctly this should 
be fixed.

The inner of the two variables can simply be removed.

Spotted by sparse.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---

This patch has been sent on:
- 22 Apr 2008
- 14 Apr 2008
- 31 Mar 2008
- 25 Feb 2008

 mm/hugetlb.c |    1 -
 1 file changed, 1 deletion(-)

--- linux-2.6/mm/hugetlb.c.old	2008-02-24 23:17:52.000000000 +0200
+++ linux-2.6/mm/hugetlb.c	2008-02-24 23:26:07.000000000 +0200
@@ -518,45 +518,44 @@
 static unsigned long set_max_huge_pages(unsigned long count)
 {
 	unsigned long min_count, ret;
 
 	/*
 	 * Increase the pool size
 	 * First take pages out of surplus state.  Then make up the
 	 * remaining difference by allocating fresh huge pages.
 	 *
 	 * We might race with alloc_buddy_huge_page() here and be unable
 	 * to convert a surplus huge page to a normal huge page. That is
 	 * not critical, though, it just means the overall size of the
 	 * pool might be one hugepage larger than it needs to be, but
 	 * within all the constraints specified by the sysctls.
 	 */
 	spin_lock(&hugetlb_lock);
 	while (surplus_huge_pages && count > persistent_huge_pages) {
 		if (!adjust_pool_surplus(-1))
 			break;
 	}
 
 	while (count > persistent_huge_pages) {
-		int ret;
 		/*
 		 * If this allocation races such that we no longer need the
 		 * page, free_huge_page will handle it by freeing the page
 		 * and reducing the surplus.
 		 */
 		spin_unlock(&hugetlb_lock);
 		ret = alloc_fresh_huge_page();
 		spin_lock(&hugetlb_lock);
 		if (!ret)
 			goto out;
 
 	}
 
 	/*
 	 * Decrease the pool size
 	 * First return free pages to the buddy allocator (being careful
 	 * to keep enough around to satisfy reservations).  Then place
 	 * pages into surplus state as needed so the pool will shrink
 	 * to the desired size as pages become free.
 	 *
 	 * By placing pages into the surplus state independent of the
 	 * overcommit value, we are allowing the surplus pool size to



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

* [2.6 patch] mm/hugetlb.c: fix duplicate variable
@ 2008-04-21 22:50 Adrian Bunk
  0 siblings, 0 replies; 8+ messages in thread
From: Adrian Bunk @ 2008-04-21 22:50 UTC (permalink / raw)
  To: wli; +Cc: linux-kernel

It's confusing that set_max_huge_pages() contained two different 
variables named "ret", and although the code works correctly this should 
be fixed.

The inner of the two variables can simply be removed.

Spotted by sparse.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---

This patch has been sent on:
- 14 Apr 2008
- 31 Mar 2008
- 25 Feb 2008

 mm/hugetlb.c |    1 -
 1 file changed, 1 deletion(-)

--- linux-2.6/mm/hugetlb.c.old	2008-02-24 23:17:52.000000000 +0200
+++ linux-2.6/mm/hugetlb.c	2008-02-24 23:26:07.000000000 +0200
@@ -518,45 +518,44 @@
 static unsigned long set_max_huge_pages(unsigned long count)
 {
 	unsigned long min_count, ret;
 
 	/*
 	 * Increase the pool size
 	 * First take pages out of surplus state.  Then make up the
 	 * remaining difference by allocating fresh huge pages.
 	 *
 	 * We might race with alloc_buddy_huge_page() here and be unable
 	 * to convert a surplus huge page to a normal huge page. That is
 	 * not critical, though, it just means the overall size of the
 	 * pool might be one hugepage larger than it needs to be, but
 	 * within all the constraints specified by the sysctls.
 	 */
 	spin_lock(&hugetlb_lock);
 	while (surplus_huge_pages && count > persistent_huge_pages) {
 		if (!adjust_pool_surplus(-1))
 			break;
 	}
 
 	while (count > persistent_huge_pages) {
-		int ret;
 		/*
 		 * If this allocation races such that we no longer need the
 		 * page, free_huge_page will handle it by freeing the page
 		 * and reducing the surplus.
 		 */
 		spin_unlock(&hugetlb_lock);
 		ret = alloc_fresh_huge_page();
 		spin_lock(&hugetlb_lock);
 		if (!ret)
 			goto out;
 
 	}
 
 	/*
 	 * Decrease the pool size
 	 * First return free pages to the buddy allocator (being careful
 	 * to keep enough around to satisfy reservations).  Then place
 	 * pages into surplus state as needed so the pool will shrink
 	 * to the desired size as pages become free.
 	 *
 	 * By placing pages into the surplus state independent of the
 	 * overcommit value, we are allowing the surplus pool size to



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

* [2.6 patch] mm/hugetlb.c: fix duplicate variable
@ 2008-03-30 22:53 Adrian Bunk
  0 siblings, 0 replies; 8+ messages in thread
From: Adrian Bunk @ 2008-03-30 22:53 UTC (permalink / raw)
  To: wli; +Cc: linux-kernel

It's confusing that set_max_huge_pages() contained two different 
variables named "ret", and although the code works correctly this should 
be fixed.

The inner of the two variables can simply be removed.

Spotted by sparse.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---

This patch has been sent on:
- 25 Feb 2008

 mm/hugetlb.c |    1 -
 1 file changed, 1 deletion(-)

--- linux-2.6/mm/hugetlb.c.old	2008-02-24 23:17:52.000000000 +0200
+++ linux-2.6/mm/hugetlb.c	2008-02-24 23:26:07.000000000 +0200
@@ -518,45 +518,44 @@
 static unsigned long set_max_huge_pages(unsigned long count)
 {
 	unsigned long min_count, ret;
 
 	/*
 	 * Increase the pool size
 	 * First take pages out of surplus state.  Then make up the
 	 * remaining difference by allocating fresh huge pages.
 	 *
 	 * We might race with alloc_buddy_huge_page() here and be unable
 	 * to convert a surplus huge page to a normal huge page. That is
 	 * not critical, though, it just means the overall size of the
 	 * pool might be one hugepage larger than it needs to be, but
 	 * within all the constraints specified by the sysctls.
 	 */
 	spin_lock(&hugetlb_lock);
 	while (surplus_huge_pages && count > persistent_huge_pages) {
 		if (!adjust_pool_surplus(-1))
 			break;
 	}
 
 	while (count > persistent_huge_pages) {
-		int ret;
 		/*
 		 * If this allocation races such that we no longer need the
 		 * page, free_huge_page will handle it by freeing the page
 		 * and reducing the surplus.
 		 */
 		spin_unlock(&hugetlb_lock);
 		ret = alloc_fresh_huge_page();
 		spin_lock(&hugetlb_lock);
 		if (!ret)
 			goto out;
 
 	}
 
 	/*
 	 * Decrease the pool size
 	 * First return free pages to the buddy allocator (being careful
 	 * to keep enough around to satisfy reservations).  Then place
 	 * pages into surplus state as needed so the pool will shrink
 	 * to the desired size as pages become free.
 	 *
 	 * By placing pages into the surplus state independent of the
 	 * overcommit value, we are allowing the surplus pool size to

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

* [2.6 patch] mm/hugetlb.c: fix duplicate variable
@ 2008-02-25  0:09 Adrian Bunk
  0 siblings, 0 replies; 8+ messages in thread
From: Adrian Bunk @ 2008-02-25  0:09 UTC (permalink / raw)
  To: wli; +Cc: linux-kernel

It's confusing that set_max_huge_pages() contained two different 
variables named "ret", and although the code works correctly this should 
be fixed.

The inner of the two variables can simply be removed.

Spotted by sparse.

Signed-off-by: Adrian Bunk <bunk@kernel.org>

---

 mm/hugetlb.c |    1 -
 1 file changed, 1 deletion(-)

--- linux-2.6/mm/hugetlb.c.old	2008-02-24 23:17:52.000000000 +0200
+++ linux-2.6/mm/hugetlb.c	2008-02-24 23:26:07.000000000 +0200
@@ -518,45 +518,44 @@
 static unsigned long set_max_huge_pages(unsigned long count)
 {
 	unsigned long min_count, ret;
 
 	/*
 	 * Increase the pool size
 	 * First take pages out of surplus state.  Then make up the
 	 * remaining difference by allocating fresh huge pages.
 	 *
 	 * We might race with alloc_buddy_huge_page() here and be unable
 	 * to convert a surplus huge page to a normal huge page. That is
 	 * not critical, though, it just means the overall size of the
 	 * pool might be one hugepage larger than it needs to be, but
 	 * within all the constraints specified by the sysctls.
 	 */
 	spin_lock(&hugetlb_lock);
 	while (surplus_huge_pages && count > persistent_huge_pages) {
 		if (!adjust_pool_surplus(-1))
 			break;
 	}
 
 	while (count > persistent_huge_pages) {
-		int ret;
 		/*
 		 * If this allocation races such that we no longer need the
 		 * page, free_huge_page will handle it by freeing the page
 		 * and reducing the surplus.
 		 */
 		spin_unlock(&hugetlb_lock);
 		ret = alloc_fresh_huge_page();
 		spin_lock(&hugetlb_lock);
 		if (!ret)
 			goto out;
 
 	}
 
 	/*
 	 * Decrease the pool size
 	 * First return free pages to the buddy allocator (being careful
 	 * to keep enough around to satisfy reservations).  Then place
 	 * pages into surplus state as needed so the pool will shrink
 	 * to the desired size as pages become free.
 	 *
 	 * By placing pages into the surplus state independent of the
 	 * overcommit value, we are allowing the surplus pool size to

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

end of thread, other threads:[~2008-05-05 20:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-14 18:14 [2.6 patch] mm/hugetlb.c: fix duplicate variable Adrian Bunk
  -- strict thread matches above, loose matches on Subject: below --
2008-05-05 18:28 Adrian Bunk
2008-05-05 20:11 ` KOSAKI Motohiro
2008-05-05 20:19   ` Adrian Bunk
2008-05-05 20:28     ` KOSAKI Motohiro
2008-04-21 22:50 Adrian Bunk
2008-03-30 22:53 Adrian Bunk
2008-02-25  0:09 Adrian Bunk

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).