[PATCH] hugetlb: don't allow free hugetlb count fall below reserved count
authorChen, Kenneth W <[email protected]>
Fri, 31 Mar 2006 10:30:01 +0000 (02:30 -0800)
committerLinus Torvalds <[email protected]>
Fri, 31 Mar 2006 20:18:50 +0000 (12:18 -0800)
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 <[email protected]>
Cc: David Gibson <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/hugetlb.c

index d87885eb4acc8eee8dab46ff84131ed712b1350d..832f676ca038837ab87c7544d4c3344b45cdc264 100644 (file)
@@ -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);