Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2484160pxj; Mon, 10 May 2021 04:12:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXcSR0DBsLtrkVTehAXoEZzMfoUDZPrlYYLGjNR3bQe8tOWFIzR1RCRbymdkmC75STDcmS X-Received: by 2002:a17:906:a48:: with SMTP id x8mr24965286ejf.127.1620645145422; Mon, 10 May 2021 04:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645145; cv=none; d=google.com; s=arc-20160816; b=wZ+OakckoXaEv/MR1OczrAQ33/daM5/RxgKXuieULmgn84rI8qQpJ1GjUCmzNKXT/z 0WKfW8quKGxGzb8t78abX5pWySMUKfujyzdTzUDrbaDYdLKyZmdNcSvCs3XtaFQ4VvF/ 1XC9E+cqCDSPN83tw+hUNRsgGjvNBnMyHXf5i11ml0ZnhJ7ODNEuAcxm5I0cJyVT7uNO L+FFSa4FnzC9FdbqC9sROfd59q7sanGPnIzh97KIKDRcNDTFQpXpGLHLeZd5GW1/jpf4 lm6VdxrDV6osb5kcfbRE6jfcI82OwO0LIv9ftwd6KhVWhFqAfkFOheC7bPHXML1Blx72 cmyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=mnerphwfH99JJ9hxMNVnqDUBdhGB8glDJIV4fqKMDn4=; b=UdyYHebdStwZwIqXZ1tAa45e5E1CCPnyT8/juAaKFjdGkgucSU1xEiecNT94HQU2eb ns1CvejhaV3jynxbCn8k9yhE+RH6C15ADuculAHxsXwCgyhtBhqa1NVRTydt7h6r4DHF O0XAjKoKeFhIFJ4ZU/rWRsGXzMn/V8bUCUx7/GvduyrKd8G1SU3ZfGz2tSOyrSOvR2v7 OpZdKf/1S1u7oxbKB26/OkDOl+TVQYRBXgD2QZ3+Q7597rHGJzqgyBSJjgh338Q0ugol JkMnyYWuUWEojvd298Gzjk8dnLYs5lINH4/Tn8T8/ksN28heAoaw22BU/8la68fJWXbJ aUgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de17si1551966ejc.336.2021.05.10.04.12.01; Mon, 10 May 2021 04:12:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236075AbhEJLHa (ORCPT + 99 others); Mon, 10 May 2021 07:07:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:33584 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231783AbhEJKqg (ORCPT ); Mon, 10 May 2021 06:46:36 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B2313AD21; Mon, 10 May 2021 10:45:30 +0000 (UTC) Date: Mon, 10 May 2021 12:45:24 +0200 From: Oscar Salvador To: Muchun Song Cc: corbet@lwn.net, mike.kravetz@oracle.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, paulmck@kernel.org, pawan.kumar.gupta@linux.intel.com, rdunlap@infradead.org, oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, almasrymina@google.com, rientjes@google.com, willy@infradead.org, mhocko@suse.com, song.bao.hua@hisilicon.com, david@redhat.com, naoya.horiguchi@nec.com, joao.m.martins@oracle.com, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, zhengqi.arch@bytedance.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v23 6/9] mm: hugetlb: alloc the vmemmap pages associated with each HugeTLB page Message-ID: <20210510104524.GD22664@linux> References: <20210510030027.56044-1-songmuchun@bytedance.com> <20210510030027.56044-7-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210510030027.56044-7-songmuchun@bytedance.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 10, 2021 at 11:00:24AM +0800, Muchun Song wrote: > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1376,6 +1376,39 @@ static void remove_hugetlb_page(struct hstate *h, struct page *page, > h->nr_huge_pages_node[nid]--; > } > > +static void add_hugetlb_page(struct hstate *h, struct page *page, > + bool adjust_surplus) > +{ > + int zeroed; > + int nid = page_to_nid(page); > + > + VM_BUG_ON_PAGE(!HPageVmemmapOptimized(page), page); > + > + lockdep_assert_held(&hugetlb_lock); > + > + INIT_LIST_HEAD(&page->lru); > + h->nr_huge_pages++; > + h->nr_huge_pages_node[nid]++; > + > + if (adjust_surplus) { > + h->surplus_huge_pages++; > + h->surplus_huge_pages_node[nid]++; > + } > + > + set_compound_page_dtor(page, HUGETLB_PAGE_DTOR); > + set_page_private(page, 0); I think this has already been discused, so sorry about this. The only reason to need the set_page_private() is because of the dissolving function right? add_hugetlb_page() can only get reached via free_huge_page(), or dissolve_free_huge_page, and while the former clears the flags, the latter it does not. I think this function would benefit from some renaming. add_hugetlb_page() gives me no hint of what is this about, although I can figure it out reading the code. With that: Reviewed-by: Oscar Salvador -- Oscar Salvador SUSE L3