From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx200.postini.com [74.125.245.200]) by kanga.kvack.org (Postfix) with SMTP id C1B686B0068 for ; Tue, 16 Apr 2013 20:37:22 -0400 (EDT) Received: from /spool/local by e23smtp09.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 17 Apr 2013 10:28:20 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 333FC357804A for ; Wed, 17 Apr 2013 10:37:17 +1000 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r3H0NLt58192478 for ; Wed, 17 Apr 2013 10:23:21 +1000 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r3H0akml000710 for ; Wed, 17 Apr 2013 10:36:46 +1000 From: Wanpeng Li Subject: [PATCH v2 3/6] mm/hugetlb: enable gigantic hugetlb page pools shrinking Date: Wed, 17 Apr 2013 08:36:31 +0800 Message-Id: <1366158995-3116-4-git-send-email-liwanp@linux.vnet.ibm.com> In-Reply-To: <1366158995-3116-1-git-send-email-liwanp@linux.vnet.ibm.com> References: <1366158995-3116-1-git-send-email-liwanp@linux.vnet.ibm.com> Sender: owner-linux-mm@kvack.org List-ID: To: Andrew Morton Cc: Andi Kleen , KAMEZAWA Hiroyuki , Michal Hocko , Mel Gorman , Rik van Riel , Hillf Danton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wanpeng Li Enable gigantic hugetlb page pools shrinking. Signed-off-by: Wanpeng Li --- mm/hugetlb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index eeaf6f2..328f140 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1416,7 +1416,8 @@ static unsigned long set_max_huge_pages(struct hstate *h, unsigned long count, { unsigned long min_count, ret; - if (h->order >= MAX_ORDER) + if (h->order >= MAX_ORDER && (!hugetlb_shrink_gigantic_pool || + count > persistent_huge_pages(h))) return h->max_huge_pages; /* @@ -1542,7 +1543,7 @@ static ssize_t nr_hugepages_store_common(bool obey_mempolicy, goto out; h = kobj_to_hstate(kobj, &nid); - if (h->order >= MAX_ORDER) { + if (h->order >= MAX_ORDER && !hugetlb_shrink_gigantic_pool) { err = -EINVAL; goto out; } @@ -2036,7 +2037,7 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy, tmp = h->max_huge_pages; - if (write && h->order >= MAX_ORDER) + if (write && h->order >= MAX_ORDER && !hugetlb_shrink_gigantic_pool) return -EINVAL; table->data = &tmp; -- 1.7.10.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org