From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752232AbcHHRPN (ORCPT ); Mon, 8 Aug 2016 13:15:13 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:37920 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752123AbcHHRPM (ORCPT ); Mon, 8 Aug 2016 13:15:12 -0400 Subject: Re: [PATCH] mm: fix the incorrect hugepages count To: zhongjiang , Naoya Horiguchi , akpm@linux-foundation.org References: <1470624546-902-1-git-send-email-zhongjiang@huawei.com> Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org From: Mike Kravetz Message-ID: Date: Mon, 8 Aug 2016 10:14:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <1470624546-902-1-git-send-email-zhongjiang@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/07/2016 07:49 PM, zhongjiang wrote: > From: zhong jiang > > when memory hotplug enable, free hugepages will be freed if movable node offline. > therefore, /proc/sys/vm/nr_hugepages will be incorrect. > > The patch fix it by reduce the max_huge_pages when the node offline. > > Signed-off-by: zhong jiang > --- > mm/hugetlb.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index f904246..3356e3a 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1448,6 +1448,7 @@ static void dissolve_free_huge_page(struct page *page) > list_del(&page->lru); > h->free_huge_pages--; > h->free_huge_pages_node[nid]--; > + h->max_huge_pages--; > update_and_free_page(h, page); > } > spin_unlock(&hugetlb_lock); > Adding Naoya as he was the original author of this code. >>From quick look it appears that the huge page will be migrated (allocated on another node). If my understanding is correct, then max_huge_pages should not be adjusted here. -- Mike Kravetz