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 6437CC63777 for ; Mon, 23 Nov 2020 08:54:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 97A152078E for ; Mon, 23 Nov 2020 08:54:36 +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="S70EpVIP" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97A152078E 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 9B64A6B005D; Mon, 23 Nov 2020 03:54:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 966626B0070; Mon, 23 Nov 2020 03:54:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82D946B0071; Mon, 23 Nov 2020 03:54:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id 5644C6B005D for ; Mon, 23 Nov 2020 03:54:35 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E5780181AEF10 for ; Mon, 23 Nov 2020 08:54:34 +0000 (UTC) X-FDA: 77515072068.20.crib28_5103ce427364 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id BB33A180C0616 for ; Mon, 23 Nov 2020 08:54:34 +0000 (UTC) X-HE-Tag: crib28_5103ce427364 X-Filterd-Recvd-Size: 7337 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Nov 2020 08:54:34 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id b23so812490pls.11 for ; Mon, 23 Nov 2020 00:54:33 -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=+bYpsl8R9NvO/I5lN+BmuwOl70TRIsehsuL2xad98dg=; b=S70EpVIPjzIAK5nZ7KUmoydETAntPJamCslr4CbpuhjTFouDc0sfycP4I9S5jc4V12 3CYcPiUZJR1TrV3XChtafJEEb3kabGjGfG3pIbI7kG+en3p+Zmw5NFGwHKmlDC8QsREc NYM+Gg4XzlqhW6d5Lg59iSB2acN5FN0eUBt94oTklB0VzsDC6RErR76C55MuchLXj6oM ktJbtKcbViCqOijsP7s73R2j7CaPPGR0DA0FZ8+onobungDtZd2SjRvZ1tkpmtbFfmGw q91FKsW0XkTmSnkZG86k4rrObeOrzNg4NnukYemJktelhKtPS6Ezi9VxYIGjBoJTWllt 7qxg== 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=+bYpsl8R9NvO/I5lN+BmuwOl70TRIsehsuL2xad98dg=; b=ANNBwqJrEGpRVq11ph8mfkyrXeT2NUFKxgXYwPYrl/GDogGc0QVRhCgvTgz+4LZvGp /6pLwbryxYDWx+NmjKcGD1lvjnwwrdDoauH19YdeOuhiQj2R3qRHE2F2NBhxYRMO5x1w JUgKkMGmsVUWwHKfZO3ViCQd/yYUaQeWZ7TVPJhNLG74/JnsZmtoopTSizW5jZAAYjmB OIaNU+1gy43MS5UcCOCVAcuCx+5sc+I5VYlZ+lC3Bqmct0W7EHPaH6gnj/fW8IdrOgJd gRVvHuwsuJai0Dzc0TLBQTsI8DaCZAXNyHXqh2HfFyaRF9YzxZziwup6pAZhlFTmaPFZ QEeg== X-Gm-Message-State: AOAM531y3D0Dtomnb3nQfzgKAX7oAeiNKIOWu8fYIc6XTxCEBNprgPB9 DvnGmiAg6CTe/zPguxNjYBXT3qxG9EC4XdsTgZGtCQ== X-Google-Smtp-Source: ABdhPJwq0k/O5Uc/JRdE+7QUeFuc9rwPeHWeJehd8e8HxO9FsA6DBl6oXeKnVkQ75hHtSHTg49fQ6xxBtkD8Wa9RyPE= X-Received: by 2002:a17:902:c14b:b029:d6:ab18:108d with SMTP id 11-20020a170902c14bb02900d6ab18108dmr23794233plj.20.1606121672924; Mon, 23 Nov 2020 00:54:32 -0800 (PST) MIME-Version: 1.0 References: <20201120064325.34492-1-songmuchun@bytedance.com> <20201120084202.GJ3200@dhcp22.suse.cz> <20201120131129.GO3200@dhcp22.suse.cz> <20201123074046.GB27488@dhcp22.suse.cz> In-Reply-To: <20201123074046.GB27488@dhcp22.suse.cz> From: Muchun Song Date: Mon, 23 Nov 2020 16:53:53 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v5 00/21] Free some vmemmap pages of hugetlb page To: Michal Hocko 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 , "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 Mon, Nov 23, 2020 at 3:40 PM Michal Hocko wrote: > > On Fri 20-11-20 23:44:26, Muchun Song wrote: > > On Fri, Nov 20, 2020 at 9:11 PM Michal Hocko wrote: > > > > > > On Fri 20-11-20 20:40:46, Muchun Song wrote: > > > > On Fri, Nov 20, 2020 at 4:42 PM Michal Hocko wrote: > > > > > > > > > > On Fri 20-11-20 14:43:04, Muchun Song wrote: > > > > > [...] > > > > > > > > > > Thanks for improving the cover letter and providing some numbers. I have > > > > > only glanced through the patchset because I didn't really have more time > > > > > to dive depply into them. > > > > > > > > > > Overall it looks promissing. To summarize. I would prefer to not have > > > > > the feature enablement controlled by compile time option and the kernel > > > > > command line option should be opt-in. I also do not like that freeing > > > > > the pool can trigger the oom killer or even shut the system down if no > > > > > oom victim is eligible. > > > > > > > > Hi Michal, > > > > > > > > I have replied to you about those questions on the other mail thread. > > > > > > > > Thanks. > > > > > > > > > > > > > > One thing that I didn't really get to think hard about is what is the > > > > > effect of vmemmap manipulation wrt pfn walkers. pfn_to_page can be > > > > > invalid when racing with the split. How do we enforce that this won't > > > > > blow up? > > > > > > > > This feature depends on the CONFIG_SPARSEMEM_VMEMMAP, > > > > in this case, the pfn_to_page can work. The return value of the > > > > pfn_to_page is actually the address of it's struct page struct. > > > > I can not figure out where the problem is. Can you describe the > > > > problem in detail please? Thanks. > > > > > > struct page returned by pfn_to_page might get invalid right when it is > > > returned because vmemmap could get freed up and the respective memory > > > released to the page allocator and reused for something else. See? > > > > If the HugeTLB page is already allocated from the buddy allocator, > > the struct page of the HugeTLB can be freed? Does this exist? > > Nope, struct pages only ever get deallocated when the respective memory > (they describe) is hotremoved via hotplug. > > > If yes, how to free the HugeTLB page to the buddy allocator > > (cannot access the struct page)? > > But I do not follow how that relates to my concern above. Sorry. I shouldn't understand your concerns. vmemmap pages page frame +-----------+ mapping to +-----------+ | | -------------> | 0 | +-----------+ +-----------+ | | -------------> | 1 | +-----------+ +-----------+ | | -------------> | 2 | +-----------+ +-----------+ | | -------------> | 3 | +-----------+ +-----------+ | | -------------> | 4 | +-----------+ +-----------+ | | -------------> | 5 | +-----------+ +-----------+ | | -------------> | 6 | +-----------+ +-----------+ | | -------------> | 7 | +-----------+ +-----------+ In this patch series, we will free the page frame 2-7 to the buddy allocator. You mean that pfn_to_page can return invalid value when the pfn is the page frame 2-7? Thanks. > > -- > Michal Hocko > SUSE Labs -- Yours, Muchun