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.8 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 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 D7870C4167B for ; Wed, 9 Dec 2020 10:17:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4D1F423B7E for ; Wed, 9 Dec 2020 10:17:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D1F423B7E 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 9B9CB8D0011; Wed, 9 Dec 2020 05:17:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 968FE8D000B; Wed, 9 Dec 2020 05:17:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 859358D0011; Wed, 9 Dec 2020 05:17:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id 6F8728D000B for ; Wed, 9 Dec 2020 05:17:18 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3607433C4 for ; Wed, 9 Dec 2020 10:17:18 +0000 (UTC) X-FDA: 77573341356.07.metal32_50009e9273ee Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 140501803F9A0 for ; Wed, 9 Dec 2020 10:17:18 +0000 (UTC) X-HE-Tag: metal32_50009e9273ee X-Filterd-Recvd-Size: 5986 Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Dec 2020 10:17:17 +0000 (UTC) Received: by mail-pl1-f194.google.com with SMTP id s2so677430plr.9 for ; Wed, 09 Dec 2020 02:17:17 -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=i6nki0stxvDLMDU16G+h85cVFW5HA5XUXV7cTIWJJr0=; b=pvUndUzCm8phQVX+DQW2QbqJ6hP9Mo1rCH6uiOZCqqpSNGU9AL8BzqhYf42rozN7IS l5Yzs+0CjrRX0Z6S4G66CTxWCnl793hSRan0/U/azt8MSlaLczL2lfXWVh/tF4TE0cMK k/Y4ljOcfwGflRPHG/C7BHPw2td3XFUEFUYEVDupOvEb9FhIMV6eI7ZvF1G+BaqnuiWu 6FfASOuRfrMdUUyOTrK5OtqN11+ZF/sWPIl22uwKKkTupgFH6BAdoV04vtfaqR8FdjQ7 xlcPF0pW0V6Plql9HIJolEdv59J2SxcKJwjFLEr7gDNWWqzwQYvgLmZCtR9Xld+G24IZ 6cpQ== 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=i6nki0stxvDLMDU16G+h85cVFW5HA5XUXV7cTIWJJr0=; b=qA6DUNCZFk8T5HUYcce38cDOyhUwE8c0i9e/Fa6o6hm+mlVabx73LQnZhaTVvy/qu2 8040AEQUvtZZ6oE1uFZ3wggjAMafWVHu+p3nBNM/9lrA5AJnIdjRqS7cOt1Xr96Sche6 20Y5E91PtnRnWN3Fw0CnFmhFeaJEGMrKEha350O5ARq+DWXb697KC8xOnJP/EDACiVFB XGFhn21hxkSmSihdPAo1NRxWbpchdGzVcWMSsUzOZ7XksbMfuvBAS4F5Je5DyoXVHyCs R1EyOwKd0QO86YTrGHZdmYA4uekAP5p5N7p50yoC3Andcw7tUM/1UVyMXbAHWktVBikZ LmiQ== X-Gm-Message-State: AOAM531bpyly86+S/y9hZDF3jFLSv/ivTk8joOhDPctoR9Op0KHHNGi/ hrAhO8a7eVTT2i0dsZXSY+lanR9DnFJXJdgV3jOa2w== X-Google-Smtp-Source: ABdhPJwl0QKoTLMWry62ykQQQg/oA1aCc3XrZuGoJQcckNVK8qnVxEk3a+7jD8/okgrNoYprcRELUScKGF6oOLWx0fQ= X-Received: by 2002:a17:902:ed0d:b029:da:c83b:5f40 with SMTP id b13-20020a170902ed0db02900dac83b5f40mr1585560pld.20.1607509036409; Wed, 09 Dec 2020 02:17:16 -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 18:16:40 +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. Good question. I also thought about this question. Just like the macro SPINLOCK_SIZE does, we also can generate a new macro to indicate the size of the struct page. :) > > -- > Thanks, > > David / dhildenb > -- Yours, Muchun