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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 A507AC55178 for ; Thu, 29 Oct 2020 13:26:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0335B2075E for ; Thu, 29 Oct 2020 13:26:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0335B2075E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5F8F96B0070; Thu, 29 Oct 2020 09:26:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A78A6B0072; Thu, 29 Oct 2020 09:26:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 496C26B0073; Thu, 29 Oct 2020 09:26:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id 1BE506B0070 for ; Thu, 29 Oct 2020 09:26:33 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B22763621 for ; Thu, 29 Oct 2020 13:26:32 +0000 (UTC) X-FDA: 77425037424.26.boats53_541846e2728d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id 8668E1804B66A for ; Thu, 29 Oct 2020 13:26:32 +0000 (UTC) X-HE-Tag: boats53_541846e2728d X-Filterd-Recvd-Size: 2936 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Thu, 29 Oct 2020 13:26:31 +0000 (UTC) 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 B47C4AC77; Thu, 29 Oct 2020 13:26:30 +0000 (UTC) Date: Thu, 29 Oct 2020 14:26:27 +0100 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, mchehab+huawei@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, duanxiongchun@bytedance.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2 04/19] mm/hugetlb: Introduce nr_free_vmemmap_pages in the struct hstate Message-ID: <20201029132621.GA2842@linux> References: <20201026145114.59424-1-songmuchun@bytedance.com> <20201026145114.59424-5-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201026145114.59424-5-songmuchun@bytedance.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Mon, Oct 26, 2020 at 10:50:59PM +0800, Muchun Song wrote: > If the size of hugetlb page is 2MB, we need 512 struct page structures > (8 pages) to be associated with it. As far as I know, we only use the > first 4 struct page structures. As Mike pointed out, better describe what those "4" mean. > For tail pages, the value of compound_dtor is the same. So we can reuse I might be missing something, but HUGETLB_PAGE_DTOR is only set on the first tail, right? > +#ifdef CONFIG_HUGETLB_PAGE_FREE_VMEMMAP > +#define RESERVE_VMEMMAP_NR 2U Although you can get that from the changelog, maybe a brief comment explaining why RESERVE_VMEMMAP_NR == 2. > + > +static inline unsigned int nr_free_vmemmap(struct hstate *h) > +{ > + return h->nr_free_vmemmap_pages; > +} Better add this in the patch that is used? > + if (vmemmap_pages > RESERVE_VMEMMAP_NR) > + h->nr_free_vmemmap_pages = vmemmap_pages - RESERVE_VMEMMAP_NR; > + else > + h->nr_free_vmemmap_pages = 0; Can we really have an scenario where we end up with vmemmap_pages < RESERVE_VMEMMAP_NR? > + > + pr_info("HugeTLB: can free %d vmemmap pages for %s\n", > + h->nr_free_vmemmap_pages, h->name); I do not think this is useful unless debugging situations, so I would either scratch that or make it pr_debug. -- Oscar Salvador SUSE L3