diff options
author | Joonsoo Kim <[email protected]> | 2013-09-11 14:21:51 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2013-09-11 15:57:42 -0700 |
commit | 4ef91848043679b272a1a5b8e2879acf696ba9e2 (patch) | |
tree | c3b84c11107f2a3885721edcee54fe6fdce07ba7 | |
parent | 0f1cfe9d0d06fe44c2b310401d2db101968e8c58 (diff) |
mm, hugetlb: protect reserved pages when soft offlining a hugepage
Don't use the reserve pool when soft offlining a hugepage. Check we have
free pages outside the reserve pool before we dequeue the huge page.
Otherwise, we can steal other's reserve page.
Signed-off-by: Joonsoo Kim <[email protected]>
Reviewed-by: Aneesh Kumar <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Reviewed-by: Davidlohr Bueso <[email protected]>
Cc: David Gibson <[email protected]>
Cc: Wanpeng Li <[email protected]>
Cc: Hillf Danton <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | mm/hugetlb.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 5b084c7b34c6..583db1948145 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -955,10 +955,11 @@ static struct page *alloc_buddy_huge_page(struct hstate *h, int nid) */ struct page *alloc_huge_page_node(struct hstate *h, int nid) { - struct page *page; + struct page *page = NULL; spin_lock(&hugetlb_lock); - page = dequeue_huge_page_node(h, nid); + if (h->free_huge_pages - h->resv_huge_pages > 0) + page = dequeue_huge_page_node(h, nid); spin_unlock(&hugetlb_lock); if (!page) |