Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 93987
b: refs/heads/master
c: 19fc3f0
h: refs/heads/master
i:
  93985: 5a76d38
  93983: 48247f1
v: v3
  • Loading branch information
Adam Litke authored and Linus Torvalds committed Apr 28, 2008
1 parent 063cd6d commit 7da89d1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 797df5749032c2286bc7ff3a52de41fde0cdf0a5
refs/heads/master: 19fc3f0acde32636529969570055c7e2a744787c
17 changes: 12 additions & 5 deletions trunk/mm/hugetlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,22 +372,29 @@ static int gather_surplus_pages(int delta)
resv_huge_pages += delta;
ret = 0;
free:
/* Free the needed pages to the hugetlb pool */
list_for_each_entry_safe(page, tmp, &surplus_list, lru) {
if ((--needed) < 0)
break;
list_del(&page->lru);
if ((--needed) >= 0)
enqueue_huge_page(page);
else {
enqueue_huge_page(page);
}

/* Free unnecessary surplus pages to the buddy allocator */
if (!list_empty(&surplus_list)) {
spin_unlock(&hugetlb_lock);
list_for_each_entry_safe(page, tmp, &surplus_list, lru) {
list_del(&page->lru);
/*
* The page has a reference count of zero already, so
* call free_huge_page directly instead of using
* put_page. This must be done with hugetlb_lock
* unlocked which is safe because free_huge_page takes
* hugetlb_lock before deciding how to free the page.
*/
spin_unlock(&hugetlb_lock);
free_huge_page(page);
spin_lock(&hugetlb_lock);
}
spin_lock(&hugetlb_lock);
}

return ret;
Expand Down

0 comments on commit 7da89d1

Please sign in to comment.