From mboxrd@z Thu Jan 1 00:00:00 1970 From: akpm@linux-foundation.org Subject: + mm-hugetlb-support-gigantic-surplus-pages.patch added to -mm tree Date: Mon, 14 Nov 2016 14:44:55 -0800 Message-ID: <582a3e67.8vFxevXDbcL49AeJ%akpm@linux-foundation.org> Reply-To: linux-kernel@vger.kernel.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from mail.linuxfoundation.org ([140.211.169.12]:53294 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S941108AbcKNWo4 (ORCPT ); Mon, 14 Nov 2016 17:44:56 -0500 Sender: mm-commits-owner@vger.kernel.org List-Id: mm-commits@vger.kernel.org To: shijie.huang@arm.com, aneesh.kumar@linux.vnet.ibm.com, catalin.marinas@arm.com, gerald.schaefer@de.ibm.com, kaly.xin@arm.com, kirill.shutemov@linux.intel.com, mhocko@suse.com, mike.kravetz@oracle.com, n-horiguchi@ah.jp.nec.com, steve.capper@arm.com, will.deacon@arm.com, mm-commits@vger.kernel.org The patch titled Subject: mm: hugetlb: support gigantic surplus pages has been added to the -mm tree. Its filename is mm-hugetlb-support-gigantic-surplus-pages.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-hugetlb-support-gigantic-surplus-pages.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-hugetlb-support-gigantic-surplus-pages.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Huang Shijie Subject: mm: hugetlb: support gigantic surplus pages When testing the gigantic page whose order is too large for the buddy allocator, the libhugetlbfs test case "counter.sh" will fail. The failure is caused by: 1) kernel fails to allocate a gigantic page for the surplus case. And the gather_surplus_pages() will return NULL in the end. 2) The condition checks for "over-commit" is wrong. This patch uses __hugetlb_alloc_gigantic_page() to allocate the gigantic page in the __alloc_huge_page(). After this patch, gather_surplus_pages() can return a gigantic page for the surplus case. This patch also changes the condition checks for: return_unused_surplus_pages() nr_overcommit_hugepages_store() hugetlb_overcommit_handler() After this patch, the counter.sh test can pass for the gigantic page. Link: http://lkml.kernel.org/r/1479107259-2011-7-git-send-email-shijie.huang@arm.com Signed-off-by: Huang Shijie Cc: Catalin Marinas Cc: Naoya Horiguchi Cc: Michal Hocko Cc: Kirill A . Shutemov Cc: Aneesh Kumar K.V Cc: Gerald Schaefer Cc: Mike Kravetz Cc: Will Deacon Cc: Steve Capper Cc: Kaly Xin Signed-off-by: Andrew Morton --- mm/hugetlb.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff -puN mm/hugetlb.c~mm-hugetlb-support-gigantic-surplus-pages mm/hugetlb.c --- a/mm/hugetlb.c~mm-hugetlb-support-gigantic-surplus-pages +++ a/mm/hugetlb.c @@ -1647,7 +1647,7 @@ static struct page *__alloc_huge_page(st struct page *page; unsigned int r_nid; - if (hstate_is_gigantic(h)) + if (hstate_is_gigantic(h) && !gigantic_page_supported()) return NULL; /* @@ -1692,7 +1692,10 @@ static struct page *__alloc_huge_page(st } spin_unlock(&hugetlb_lock); - page = __hugetlb_alloc_buddy_huge_page(h, vma, addr, nid); + if (hstate_is_gigantic(h)) + page = __hugetlb_alloc_gigantic_page(h, vma, addr, nid); + else + page = __hugetlb_alloc_buddy_huge_page(h, vma, addr, nid); spin_lock(&hugetlb_lock); if (page) { @@ -1859,8 +1862,7 @@ static void return_unused_surplus_pages( /* Uncommit the reservation */ h->resv_huge_pages -= unused_resv_pages; - /* Cannot return gigantic pages currently */ - if (hstate_is_gigantic(h)) + if (hstate_is_gigantic(h) && !gigantic_page_supported()) return; nr_pages = min(unused_resv_pages, h->surplus_huge_pages); @@ -2577,7 +2579,7 @@ static ssize_t nr_overcommit_hugepages_s unsigned long input; struct hstate *h = kobj_to_hstate(kobj, NULL); - if (hstate_is_gigantic(h)) + if (hstate_is_gigantic(h) && !gigantic_page_supported()) return -EINVAL; err = kstrtoul(buf, 10, &input); @@ -3018,7 +3020,7 @@ int hugetlb_overcommit_handler(struct ct tmp = h->nr_overcommit_huge_pages; - if (write && hstate_is_gigantic(h)) + if (write && hstate_is_gigantic(h) && !gigantic_page_supported()) return -EINVAL; table->data = &tmp; _ Patches currently in -mm which might be from shijie.huang@arm.com are mm-hugetlb-rename-some-allocation-functions.patch mm-hugetlb-add-a-new-parameter-for-some-functions.patch mm-hugetlb-change-the-return-type-for-alloc_fresh_gigantic_page.patch mm-mempolicy-intruduce-a-helper-huge_nodemask.patch mm-hugetlb-add-a-new-function-to-allocate-a-new-gigantic-page.patch mm-hugetlb-support-gigantic-surplus-pages.patch