소스 검색

[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 <kenneth.w.chen@intel.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Chen, Kenneth W 20 년 전
부모
커밋
78c997a4be
1개의 변경된 파일1개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      mm/hugetlb.c

+ 1 - 0
mm/hugetlb.c

@@ -334,6 +334,7 @@ static unsigned long set_max_huge_pages(unsigned long count)
 		return nr_huge_pages;
 		return nr_huge_pages;
 
 
 	spin_lock(&hugetlb_lock);
 	spin_lock(&hugetlb_lock);
+	count = max(count, reserved_huge_pages);
 	try_to_free_low(count);
 	try_to_free_low(count);
 	while (count < nr_huge_pages) {
 	while (count < nr_huge_pages) {
 		struct page *page = dequeue_huge_page(NULL, 0);
 		struct page *page = dequeue_huge_page(NULL, 0);