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 pag...^^^^ two? I think removal inner variable is 1, no? but, your change is perfectly right, IMHO. --
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
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
--Ah, sorry. I had misunderstanded. you are right :) --
| Andrea Arcangeli | [PATCH 06 of 11] rwsem contended |
| Mikulas Patocka | LFENCE instruction (was: [rfc][patch 3/3] x86: optimise barriers) |
| Rafael J. Wysocki | Re: [Bug 10030] Suspend doesn't work when SD card is inserted |
| Manu Abraham | PCIE |
git: | |
| Sverre Rabbelier | Git vs Monotone |
| Junio C Hamano | [ANNOUNCE] GIT 1.5.4 |
| Bill Lear | Meaning of "fatal: protocol error: bad line length character"? |
| Junio C Hamano | Re: [PATCH] Teach remote machinery about remotes.default config variable |
| Richard Stallman | Real men don't attack straw men |
| Stefan Beke | mail dovecot: pipe() failed: Too many open files |
| Wijnand Wiersma | Almost success: OpenBSD on Xen |
| Didier Wiroth | how can I "find xyz | xargs tar" ... like gtar |
| Greg A. Woods | Re: Fork bomb protection patch |
| Tyler Retzlaff | Re: more summer of code fun |
| Elad Efrat | Re: sysctl knob to let sugid processes dump core (pr 15994) |
| Thor Lancelot Simon | Re: FFS journal |
