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=-13.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 8F4BDC4361B for ; Wed, 9 Dec 2020 15:13:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F0B9123AAC for ; Wed, 9 Dec 2020 15:13:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0B9123AAC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bytedance.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 344428D0022; Wed, 9 Dec 2020 10:13:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F4118D001E; Wed, 9 Dec 2020 10:13:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E1DB8D0022; Wed, 9 Dec 2020 10:13:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0041.hostedemail.com [216.40.44.41]) by kanga.kvack.org (Postfix) with ESMTP id 0542C8D001E for ; Wed, 9 Dec 2020 10:13:45 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id C2976181AC212 for ; Wed, 9 Dec 2020 15:13:44 +0000 (UTC) X-FDA: 77574088368.19.grain00_5c09fe5273f0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 8A6CB1ACEA4 for ; Wed, 9 Dec 2020 15:13:44 +0000 (UTC) X-HE-Tag: grain00_5c09fe5273f0 X-Filterd-Recvd-Size: 6379 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Dec 2020 15:13:43 +0000 (UTC) Received: by mail-pl1-f196.google.com with SMTP id v3so1065862plz.13 for ; Wed, 09 Dec 2020 07:13:43 -0800 (PST) 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=MH2oBtgG7SM/WEjQVktVm6vzkLZc11BiXccpenn6u5w=; b=veTVgAoUehNGrKZIOLlBn2vp5nNt2WZg/o23lwAg/fsGibfKfMJcJw3iWo+tUytQzS Q4IKHPYhpizNVCD+7+LDs72sFFQSnpYnN33k3SGvTMThqaycRloc+azGCc4UyljH+T8r Lg8DJ+rmLIYj1t4VvDnE9WiGPAYNBrOS1EJEtwPaVe6dIXfaq/fettA58rI8RN7EkBUN //DVuFJbb92zLltzHOC7cZlRv7a6Gbm3vuhDYlcp+W8gNyPb3fEAqNtyHwcxQ1Jp3cLT g0hiyRFhL6I4ib0Ov1mP/mQNVH3ImSWHVnYAt/LYj94DdLGjf0C/E9rzx3kdj1EvzFM5 c9mg== 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=MH2oBtgG7SM/WEjQVktVm6vzkLZc11BiXccpenn6u5w=; b=ELzkNOfy8k3FQ2q1zhg4nRmyj95kmY50JNFFNFkTdUQs0fhbv+JO4ylGkW/4mHl0nA iwR3dynU2boUYZk6OsTLClzYTNQ03qjNyvXyw8HN36WY8qyuhSN0I+ev1juR+mezdXZ0 //e1ejb2oEcAsYG1sT337y1vUoI9i7YBOv747lNPJ1Zy0ztqn8Tx1dQQe9OnUpYJKKxh ab2ag63ZxcDZGS8N82ccwVnWHIhfXO10pycnSnLsb4nu9P3zMXpnLF2fBE1UZkcNeNv0 ICApF7E/uDxzQtnqmHjH/baFuFsAIkxrn5ylB6vO17c8MQdzvtrfp8wU9GNQE7R+1Cvk o25w== X-Gm-Message-State: AOAM532pdHK3ME+MKcCd9mwGuaXl0FQuSbTCG0V6QK+3U8DwwYeP1HTM 00miBVJKmkdcZq/qkZv5BvNA8kQ7wj6ir2dRMLcfAg== X-Google-Smtp-Source: ABdhPJzy9V7tyAUDxcV027ueD0F0tNTha+NK7Tvb0IvWRd4/heU72ewIi40CX5slgfRaL4RB5vtjw1qzSz/Nznch+dw= X-Received: by 2002:a17:902:bb92:b029:d9:e9bf:b775 with SMTP id m18-20020a170902bb92b02900d9e9bfb775mr2657733pls.24.1607526822541; Wed, 09 Dec 2020 07:13:42 -0800 (PST) MIME-Version: 1.0 References: <20201130151838.11208-1-songmuchun@bytedance.com> <20201130151838.11208-7-songmuchun@bytedance.com> <4b8a9389-1704-4d8c-ec58-abd753814dd9@redhat.com> In-Reply-To: From: Muchun Song Date: Wed, 9 Dec 2020 23:13:06 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v7 06/15] mm/hugetlb: Disable freeing vmemmap if struct page size is not power of two To: David Hildenbrand 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 , Oscar Salvador , Michal Hocko , "Song Bao Hua (Barry Song)" , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel Content-Type: text/plain; charset="UTF-8" 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 Wed, Dec 9, 2020 at 6:10 PM David Hildenbrand wrote: > > On 09.12.20 11:06, David Hildenbrand wrote: > > On 09.12.20 11:03, Muchun Song wrote: > >> On Wed, Dec 9, 2020 at 5:57 PM David Hildenbrand wrote: > >>> > >>> On 30.11.20 16:18, Muchun Song wrote: > >>>> We only can free the tail vmemmap pages of HugeTLB to the buddy allocator > >>>> when the size of struct page is a power of two. > >>>> > >>>> Signed-off-by: Muchun Song > >>>> --- > >>>> mm/hugetlb_vmemmap.c | 5 +++++ > >>>> 1 file changed, 5 insertions(+) > >>>> > >>>> diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c > >>>> index 51152e258f39..ad8fc61ea273 100644 > >>>> --- a/mm/hugetlb_vmemmap.c > >>>> +++ b/mm/hugetlb_vmemmap.c > >>>> @@ -111,6 +111,11 @@ void __init hugetlb_vmemmap_init(struct hstate *h) > >>>> unsigned int nr_pages = pages_per_huge_page(h); > >>>> unsigned int vmemmap_pages; > >>>> > >>>> + if (!is_power_of_2(sizeof(struct page))) { > >>>> + pr_info("disable freeing vmemmap pages for %s\n", h->name); > >>> > >>> I'd just drop that pr_info(). Users are able to observe that it's > >>> working (below), so they are able to identify that it's not working as well. > >> > >> The below is just a pr_debug. Do you suggest converting it to pr_info? > > > > Good question. I wonder if users really have to know in most cases. > > Maybe pr_debug() is good enough in environments where we want to debug > > why stuff is not working as expected. > > > > Oh, another thought, can we glue availability of > HUGETLB_PAGE_FREE_VMEMMAP (or a new define based on the config and the > size of a stuct page) to the size of struct page somehow? > > I mean, it's known at compile time that this will never work. I want to define a macro which indicates the size of the struct page. There is place (kernel/bounds.c) where can do similar things. When I added the following code in that file. DEFINE(STRUCT_PAGE_SIZE, sizeof(struct page)); Then the compiler will output a message like: make[2]: Circular kernel/bounds.s <- include/generated/bounds.h dependency dropped. Then I realise that the size of the struct page also depends on include/generated/bounds.h. But this file is not generated. Hi David, Do you have some idea about this? > > -- > Thanks, > > David / dhildenb > -- Yours, Muchun