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=-3.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 59831C5DF9D for ; Thu, 29 Oct 2020 13:43:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F16E520E65 for ; Thu, 29 Oct 2020 13:43:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=bytedance-com.20150623.gappssmtp.com header.i=@bytedance-com.20150623.gappssmtp.com header.b="u91kGQbe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727487AbgJ2Nmd (ORCPT ); Thu, 29 Oct 2020 09:42:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727470AbgJ2Nmc (ORCPT ); Thu, 29 Oct 2020 09:42:32 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72481C0613D6 for ; Thu, 29 Oct 2020 06:42:25 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id w1so2835096wrm.4 for ; Thu, 29 Oct 2020 06:42:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2sP4gGJw9r+NchdLRSOmNItoBGxNPh2amTUBIn7g1jk=; b=u91kGQbepRwV6CBnVlOo0b3Ay7d1EQjInWPDaaj4wkoOWUdXCTegxWaE3ozKnEknUB +eYQOPliDFDGe80DJ/8LITnX6yLVfq8u7VFgkdgLmvf80pGeEyBiRuILrAkce9CwKmMP ZSY6JlkFzTNHrTvnmYu/d643GMWgnWY7jCLoUDvXYUapiXviuOdxZR81vsfu5y57B6Z0 8UkMQ/wNdD/r963I3Kh+77LgbrWItHBm+eBdbeFb6184nZ8LBMH/92yDE7rli3UzGcCz zx8zJLy44lTPIJ465U32VxI9n9tPWlXzfTJBOB8Bxsq9UAgyvcuWLj6du6M2jyOr8FLD 36uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2sP4gGJw9r+NchdLRSOmNItoBGxNPh2amTUBIn7g1jk=; b=EGxYRY8JYOpOY1a8/XCH65DjLyRhp/VF0Aek93HKFHYEeZRJDQkrTOLhjUKSdpdb9y 0ZgJitSvKzGVG6HVm9Dd18kAxjIAlxCAgGmKrePHVIp+JT9vZFqrBPrfY0oGy+Zp3qi4 g1K1zmVfnIjOUAheuEOVPM9TV2unDNdVIHOPYYDYMbqCcdUg7yPSrCLhjwIGwN+UDzIR mCCtrhkNZiXXkLVHDbvDx1E2ut79r+vR84kUdZQEBN9gH8vSNXoWCHOVl9mw5fuL1uu9 SSkzStOU1Ds/XktYHW5BLWjfH8yQfbMXrEMIaurG1NIbGaSI5GfozhYOB+T4HWZrskCG abaQ== X-Gm-Message-State: AOAM532k2HUATdUwV4ZfYyPCnFDD3FbP/VB0RuhP9wJFOnHJA+sxNcUp CLHTp84IcUfVCBL1ys0AM6mU5+OsCujgkq4oQxJ+0g== X-Google-Smtp-Source: ABdhPJxlhKZ1GF2ca/c147WlPJkNLJQNEKvj7ya7bC4/MHkljcImyn5PVlyfBmI32r9hjW/QIf8ThBed7ik1ZNmL2wA= X-Received: by 2002:a5d:69d1:: with SMTP id s17mr5870417wrw.398.1603978944137; Thu, 29 Oct 2020 06:42:24 -0700 (PDT) MIME-Version: 1.0 References: <20201026145114.59424-1-songmuchun@bytedance.com> <20201026145114.59424-5-songmuchun@bytedance.com> <20201029132621.GA2842@linux> In-Reply-To: <20201029132621.GA2842@linux> From: Muchun Song Date: Thu, 29 Oct 2020 21:41:46 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v2 04/19] mm/hugetlb: Introduce nr_free_vmemmap_pages in the struct hstate To: Oscar Salvador Cc: Jonathan Corbet , Mike Kravetz , Thomas Gleixner , mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, Peter Zijlstra , viro@zeniv.linux.org.uk, Andrew Morton , paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, Randy Dunlap , oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, Mina Almasry , David Rientjes , Matthew Wilcox , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Thu, Oct 29, 2020 at 9:26 PM Oscar Salvador wrote: > > 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. Yeah, thanks. > > > 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? Sorry for confusion. Here I mean the `compound_head` is the same. > > > +#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? OK, I will do it. thanks. > > > + 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? I think that this is impossible. On the safe side, I do this comparison. Do you think we should remove this comparison? Is that right? > > > + > > + 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. Thanks for your suggestions. > > > -- > Oscar Salvador > SUSE L3 -- Yours, Muchun