From: Chen, Kenneth W Date: Fri, 31 Mar 2006 10:30:01 +0000 (-0800) Subject: [PATCH] hugetlb: don't allow free hugetlb count fall below reserved count X-Git-Tag: v3.12-rc1~36946 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78c997a4be7d1ed3ff4c27f23d30a0185d39bcbf;p=kernel%2Fkernel-generic.git [PATCH] hugetlb: don't allow free hugetlb count fall below reserved count With strict page reservation, I think kernel should enforce number of free hugetlb page don't fall below reserved count. Currently it is possible in the sysctl path. Add proper check in sysctl to disallow that. Signed-off-by: Ken Chen Cc: David Gibson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/hugetlb.c b/mm/hugetlb.c index d87885e..832f676 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -334,6 +334,7 @@ static unsigned long set_max_huge_pages(unsigned long count) return nr_huge_pages; spin_lock(&hugetlb_lock); + count = max(count, reserved_huge_pages); try_to_free_low(count); while (count < nr_huge_pages) { struct page *page = dequeue_huge_page(NULL, 0);