From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752133AbbJMJPz (ORCPT ); Tue, 13 Oct 2015 05:15:55 -0400 Received: from out114-136.biz.mail.alibaba.com ([205.204.114.136]:45764 "EHLO out21.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751086AbbJMJPx (ORCPT ); Tue, 13 Oct 2015 05:15:53 -0400 X-Greylist: delayed 330 seconds by postgrey-1.27 at vger.kernel.org; Tue, 13 Oct 2015 05:15:52 EDT X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R211e4;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03271;MF=hillf.zj@alibaba-inc.com;NM=1;PH=DS;RN=5;SR=0; Reply-To: "Hillf Danton" From: "Hillf Danton" To: "Kirill A. Shutemov" , "Sasha Levin" Cc: "Andrew Morton" , "linux-kernel" , References: <004b01d10596$60e7eae0$22b7c0a0$@alibaba-inc.com> In-Reply-To: <004b01d10596$60e7eae0$22b7c0a0$@alibaba-inc.com> Subject: Re: [PATCH] hugetlb: clear PG_reserved before setting PG_head on gigantic pages Date: Tue, 13 Oct 2015 17:09:52 +0800 Message-ID: <004e01d10596$eba6de70$c2f49b50$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQJSfvBiS6RRKJK0lmT6Z42DjKTo7J1mLvRQ Content-Language: zh-cn Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > PF_NO_COMPOUND for PG_reserved assumes we don't use PG_reserved for > compound pages. And we generally don't. But during allocation of > gigantic pages we set PG_head before clearing PG_reserved and > __ClearPageReserved() steps on the VM_BUG_ON_PAGE(). > > The fix is trivial: set PG_head after PG_reserved. > > Signed-off-by: Kirill A. Shutemov > Reported-by: Sasha Levin > --- Acked-by: Hillf Danton > > Andrew, this patch can be folded into "page-flags: define PG_reserved behavior on compound pages". > > --- > mm/hugetlb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 6ecf61ffa65d..bd3f3e20313b 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1258,8 +1258,8 @@ static void prep_compound_gigantic_page(struct page *page, unsigned int order) > > /* we rely on prep_new_huge_page to set the destructor */ > set_compound_order(page, order); > - __SetPageHead(page); > __ClearPageReserved(page); > + __SetPageHead(page); > for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) { > /* > * For gigantic hugepages allocated through bootmem at > -- > 2.5.3 >