Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755836Ab3G3Qtq (ORCPT ); Tue, 30 Jul 2013 12:49:46 -0400 Received: from e23smtp07.au.ibm.com ([202.81.31.140]:45322 "EHLO e23smtp07.au.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753843Ab3G3Qtp (ORCPT ); Tue, 30 Jul 2013 12:49:45 -0400 From: "Aneesh Kumar K.V" To: Joonsoo Kim , Andrew Morton Cc: Rik van Riel , Mel Gorman , Michal Hocko , KAMEZAWA Hiroyuki , Hugh Dickins , Davidlohr Bueso , David Gibson , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Joonsoo Kim , Wanpeng Li , Naoya Horiguchi , Hillf Danton , Joonsoo Kim Subject: Re: [PATCH 01/18] mm, hugetlb: protect reserved pages when softofflining requests the pages In-Reply-To: <1375075929-6119-2-git-send-email-iamjoonsoo.kim@lge.com> References: <1375075929-6119-1-git-send-email-iamjoonsoo.kim@lge.com> <1375075929-6119-2-git-send-email-iamjoonsoo.kim@lge.com> User-Agent: Notmuch/0.15.2+167~g5306b2b (http://notmuchmail.org) Emacs/24.3.50.1 (x86_64-unknown-linux-gnu) Date: Tue, 30 Jul 2013 22:19:28 +0530 Message-ID: <8761vsq9gn.fsf@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13073016-0260-0000-0000-00000365241E Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1366 Lines: 44 Joonsoo Kim writes: > alloc_huge_page_node() use dequeue_huge_page_node() without > any validation check, so it can steal reserved page unconditionally. > To fix it, check the number of free_huge_page in > alloc_huge_page_node(). May be we should say. Don't use the reserve pool when soft offlining a huge page. Check we have free pages outside the reserve pool before we dequeue the huge page Reviewed-by: Aneesh Kumar > > Signed-off-by: Joonsoo Kim > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 6782b41..d971233 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -935,10 +935,11 @@ static struct page *alloc_buddy_huge_page(struct hstate *h, int nid) > */ > struct page *alloc_huge_page_node(struct hstate *h, int nid) > { > - struct page *page; > + struct page *page = NULL; > > spin_lock(&hugetlb_lock); > - page = dequeue_huge_page_node(h, nid); > + if (h->free_huge_pages - h->resv_huge_pages > 0) > + page = dequeue_huge_page_node(h, nid); > spin_unlock(&hugetlb_lock); > > if (!page) > -- > 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/