On Mon, Nov 07, 2016 at 04:25:04PM +0100, Gerald Schaefer wrote: > On Thu, 3 Nov 2016 10:51:38 +0800 > Huang Shijie <shijie.huang@xxxxxxx> wrote: > > > 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 adds code 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() > > > > After this patch, the counter.sh can pass for the gigantic page. > > > > Acked-by: Steve Capper <steve.capper@xxxxxxx> > > Signed-off-by: Huang Shijie <shijie.huang@xxxxxxx> > > --- > > mm/hugetlb.c | 15 ++++++++++----- > > 1 file changed, 10 insertions(+), 5 deletions(-) > > > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > > index 0bf4444..2b67aff 100644 > > --- a/mm/hugetlb.c > > +++ b/mm/hugetlb.c > > @@ -1574,7 +1574,7 @@ static struct page *__alloc_huge_page(struct hstate *h, > > struct page *page; > > unsigned int r_nid; > > > > - if (hstate_is_gigantic(h)) > > + if (hstate_is_gigantic(h) && !gigantic_page_supported()) > > return NULL; > > Is it really possible to stumble over gigantic pages w/o having > gigantic_page_supported()? > > Also, I've just tried this on s390 and counter.sh still fails after these > patches, and it should fail on all archs as long as you use the gigantic I guess the failure you met is caused by the libhugetlbfs itself, there are several bugs in the libhugetlbfs. I have a patch set for the libhugetlbfs too. I will send it as soon as possible. > hugepage size as default hugepage size. This is because you only changed > nr_overcommit_hugepages_store(), which handles nr_overcommit_hugepages > in sysfs, and missed hugetlb_overcommit_handler() which handles > /proc/sys/vm/nr_overcommit_hugepages for the default sized hugepages. This is wrong. :) I did have an extra patch to fix the hugetlb_overcommit_handler(). but the counters.sh does not use the /proc/sys/vm/nr_overcommit_hugepages. Please grep it in the code. Thanks Huang Shijie -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>