From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5AEDC433DB for ; Tue, 26 Jan 2021 06:20:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F1A5D22D04 for ; Tue, 26 Jan 2021 06:20:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F1A5D22D04 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3A58B8D0093; Tue, 26 Jan 2021 01:20:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3301B8D0076; Tue, 26 Jan 2021 01:20:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21DB28D0093; Tue, 26 Jan 2021 01:20:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0057.hostedemail.com [216.40.44.57]) by kanga.kvack.org (Postfix) with ESMTP id 07A468D0076 for ; Tue, 26 Jan 2021 01:20:19 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B0953180ACF84 for ; Tue, 26 Jan 2021 06:20:18 +0000 (UTC) X-FDA: 77746926516.08.snake78_5a164d72758c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 964841819E798 for ; Tue, 26 Jan 2021 06:20:18 +0000 (UTC) X-HE-Tag: snake78_5a164d72758c X-Filterd-Recvd-Size: 2647 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Tue, 26 Jan 2021 06:20:17 +0000 (UTC) Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4DPxQG71Q8z7b5G; Tue, 26 Jan 2021 14:19:02 +0800 (CST) Received: from [10.174.179.117] (10.174.179.117) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.498.0; Tue, 26 Jan 2021 14:20:10 +0800 Subject: Re: [PATCH] mm: hugetlb: fix missing put_page in gather_surplus_pages() To: Muchun Song CC: , , , , , References: <20210126031009.96266-1-songmuchun@bytedance.com> From: Miaohe Lin Message-ID: Date: Tue, 26 Jan 2021 14:20:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210126031009.96266-1-songmuchun@bytedance.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.117] X-CFilter-Loop: Reflected X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi: On 2021/1/26 11:10, Muchun Song wrote: > The VM_BUG_ON_PAGE avoids the generation of any code, even if that > expression has side-effects when !CONFIG_DEBUG_VM. > > Fixes: e5dfacebe4a4 ("mm/hugetlb.c: just use put_page_testzero() instead of page_count()") > Signed-off-by: Muchun Song > Cc: > --- > mm/hugetlb.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index a6bad1f686c5..082ed643020b 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -2047,13 +2047,16 @@ static int gather_surplus_pages(struct hstate *h, long delta) > > /* Free the needed pages to the hugetlb pool */ > list_for_each_entry_safe(page, tmp, &surplus_list, lru) { > + int zeroed; > + > if ((--needed) < 0) > break; > /* > * This page is now managed by the hugetlb allocator and has > * no users -- drop the buddy allocator's reference. > */ > - VM_BUG_ON_PAGE(!put_page_testzero(page), page); > + zeroed = put_page_testzero(page); > + VM_BUG_ON_PAGE(!zeroed, page); > enqueue_huge_page(h, page); > } > free: > Good Catch! Thanks. Reviewed-by: Miaohe Lin