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,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 3EB78C433DB for ; Sat, 27 Mar 2021 01:40:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B422C61A26 for ; Sat, 27 Mar 2021 01:40:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B422C61A26 Authentication-Results: mail.kernel.org; dmarc=fail (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 EBFF36B006C; Fri, 26 Mar 2021 21:40:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EA88E6B006E; Fri, 26 Mar 2021 21:40:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5D4A6B0070; Fri, 26 Mar 2021 21:40:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id BD3246B006C for ; Fri, 26 Mar 2021 21:40:50 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6429E381E for ; Sat, 27 Mar 2021 01:40:50 +0000 (UTC) X-FDA: 77963950260.25.9A0D6D8 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf15.hostedemail.com (Postfix) with ESMTP id F03BFA0009CE for ; Sat, 27 Mar 2021 01:40:45 +0000 (UTC) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4F6hLS1fPYznbNS; Sat, 27 Mar 2021 09:38:08 +0800 (CST) Received: from [10.174.178.163] (10.174.178.163) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Sat, 27 Mar 2021 09:40:39 +0800 Subject: Re: [PATCH 4/8] hugetlb: create remove_hugetlb_page() to separate functionality To: Mike Kravetz , , CC: Roman Gushchin , Michal Hocko , Shakeel Butt , Oscar Salvador , David Hildenbrand , Muchun Song , David Rientjes , Peter Zijlstra , Matthew Wilcox , HORIGUCHI NAOYA , "Aneesh Kumar K . V" , Waiman Long , Peter Xu , Mina Almasry , "Hillf Danton" , Andrew Morton References: <20210325002835.216118-1-mike.kravetz@oracle.com> <20210325002835.216118-5-mike.kravetz@oracle.com> From: Miaohe Lin Message-ID: <8395881b-5c16-d747-aa6e-fd13b7f7f53e@huawei.com> Date: Sat, 27 Mar 2021 09:40:39 +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: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.163] X-CFilter-Loop: Reflected X-Stat-Signature: rp4naouzmeyz1xgfzr5r8uhcggow5s5t X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: F03BFA0009CE Received-SPF: none (huawei.com>: No applicable sender policy available) receiver=imf15; identity=mailfrom; envelope-from=""; helo=szxga04-in.huawei.com; client-ip=45.249.212.190 X-HE-DKIM-Result: none/none X-HE-Tag: 1616809245-629170 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: On 2021/3/27 3:57, Mike Kravetz wrote: > On 3/25/21 7:10 PM, Miaohe Lin wrote: >> On 2021/3/25 8:28, Mike Kravetz wrote: >>> The new remove_hugetlb_page() routine is designed to remove a hugetlb >>> page from hugetlbfs processing. It will remove the page from the active >>> or free list, update global counters and set the compound page >>> destructor to NULL so that PageHuge() will return false for the 'page'. >>> After this call, the 'page' can be treated as a normal compound page or >>> a collection of base size pages. >>> >>> remove_hugetlb_page is to be called with the hugetlb_lock held. >>> >>> Creating this routine and separating functionality is in preparation for >>> restructuring code to reduce lock hold times. >>> >>> Signed-off-by: Mike Kravetz >>> --- >>> mm/hugetlb.c | 70 +++++++++++++++++++++++++++++++++------------------- >>> 1 file changed, 45 insertions(+), 25 deletions(-) >>> >>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c >>> index 404b0b1c5258..3938ec086b5c 100644 >>> --- a/mm/hugetlb.c >>> +++ b/mm/hugetlb.c >>> @@ -1327,6 +1327,46 @@ static inline void destroy_compound_gigantic_page(struct page *page, >>> unsigned int order) { } >>> #endif >>> >>> +/* >>> + * Remove hugetlb page from lists, and update dtor so that page appears >>> + * as just a compound page. A reference is held on the page. >>> + * NOTE: hugetlb specific page flags stored in page->private are not >>> + * automatically cleared. These flags may be used in routines >>> + * which operate on the resulting compound page. >> >> It seems HPageFreed and HPageTemporary is cleared. Which hugetlb specific page flags >> is reserverd here and why? Could you please give a simple example to clarify >> this in the comment to help understand this NOTE? >> > > I will remove that NOTE: in the comment to avoid any confusion. > > The NOTE was add in the RFC that contained a separate patch to add a flag > that tracked huge pages allocated from CMA. That flag needed to remain > for subsequent freeing of such pages. This is no longer needed. > Many thanks for explaination. I was confused about that NOTE. :) >> The code looks good to me. Many thanks! >> Reviewed-by: Miaohe Lin > > Thanks, >