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 17C95C2D0E4 for ; Mon, 23 Nov 2020 13:06:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 739A92075A for ; Mon, 23 Nov 2020 13:06:05 +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="wdtiVdCS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 739A92075A 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 BC04C6B0073; Mon, 23 Nov 2020 08:06:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B97436B0075; Mon, 23 Nov 2020 08:06:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5E466B0078; Mon, 23 Nov 2020 08:06:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 682ED6B0073 for ; Mon, 23 Nov 2020 08:06:04 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D898D181AEF15 for ; Mon, 23 Nov 2020 13:06:03 +0000 (UTC) X-FDA: 77515705806.02.swing00_4d02cc527365 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 8D82310097AA4 for ; Mon, 23 Nov 2020 13:06:03 +0000 (UTC) X-HE-Tag: swing00_4d02cc527365 X-Filterd-Recvd-Size: 5266 Received: from mail-pg1-f193.google.com (mail-pg1-f193.google.com [209.85.215.193]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Nov 2020 13:06:02 +0000 (UTC) Received: by mail-pg1-f193.google.com with SMTP id w16so1838718pga.9 for ; Mon, 23 Nov 2020 05:06:02 -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=02jqOVqVG3o3zemslXDICxm50Q80xsNgcwxbt1BQaO8=; b=wdtiVdCSXTYkX5Llm07WsCeM2l5OjQx0QT7j6/20KXIXC5Cz4YvF9BaMBeNHFUcdn1 TJOy7xJAHMWIurkODNbdhsHz13BBKEclsv/THVJRS6rEuPh24SnDOHbJVF8V1SHnqjPp oBgoisa5jgquZi4Pxjx5BoLu/ESItCsecVzOIe7Bqh6wa4uWK80WSra2iqTrqBuIk5Qg NV+54zyqCwhX2UwU7Wxp34u/na3qlnA6mq5Q7N/NFNzZYnRBvHLec/c8jyb2P0UjGGtn aBtLG8nfs00RpR1cK/vy012TRFipmmjbzfqzLiMr2hAijZLJdmuSMW5WhOLELMp3WxUB UVxA== 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=02jqOVqVG3o3zemslXDICxm50Q80xsNgcwxbt1BQaO8=; b=D8Sxk5gJ+GhAC3+uqKjJNPHSbH9ecD8yJVgEx5mDnLQI+WnEx3RbBX5tmjZKsTQPqH CKWvmO26iyih5lq//0COr3RdBffMCbDKHKo05fzLI4ANOBpNs5bjGzkkds08Au9wUnJp OH1cbTJKHhl/e8IQCcEn20Z4Gs2s4gz5mDZfoK45q0D9A7+pHfobNo6T9O+4i5N1g1e+ GH+3UgdNT4bn/d8+jnPjNk5M9NFYfK/7KNeYt3BE2Ra3jF0Z8ACO+Nom4SbHmjwXbpTt wiPNeHo8OvJ6oABS+CvMtVtfBFNWRZlEDM7Oyxc7xCLXljhaApFoDLb3RoJT+fwGawBi GtkQ== X-Gm-Message-State: AOAM532YMbFYCBpSAFWfAJEL+7dta0tLSKBppDfH4/h9RNKcHsq0ZCNB Opj2lsspXOa3aGms/APd25Z9JtX6ANXcrTEzn+cSdg== X-Google-Smtp-Source: ABdhPJw3p1FWKUpZ9PGL0u6MoANh2yKcf/YhnTR4E6ftHWfkWBw+A8Y2BLWvYmo51GlR128zahdNafwS/gBghxutmgU= X-Received: by 2002:a63:ff18:: with SMTP id k24mr26654043pgi.273.1606136761761; Mon, 23 Nov 2020 05:06:01 -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> <20201123094344.GG27488@dhcp22.suse.cz> <20201123104258.GJ27488@dhcp22.suse.cz> <20201123124513.GI4327@casper.infradead.org> In-Reply-To: <20201123124513.GI4327@casper.infradead.org> From: Muchun Song Date: Mon, 23 Nov 2020 21:05:23 +0800 Message-ID: Subject: Re: [External] Re: [PATCH v5 00/21] Free some vmemmap pages of hugetlb page To: Matthew Wilcox , 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 , 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 8:45 PM Matthew Wilcox wrote: > > On Mon, Nov 23, 2020 at 11:42:58AM +0100, Michal Hocko wrote: > > On Mon 23-11-20 18:36:33, Muchun Song wrote: > > > > No I really mean that pfn_to_page will give you a struct page pointer > > > > from pages which you release from the vmemmap page tables. Those pages > > > > might get reused as soon sa they are freed to the page allocator. > > > > > > We will remap vmemmap pages 2-7 (virtual addresses) to page > > > frame 1. And then we free page frame 2-7 to the buddy allocator. > > > > And this doesn't really happen in an atomic fashion from the pfn walker > > POV, right? So it is very well possible that > > > > struct page *page = pfn_to_page(); > > // remapping happens here > > // page content is no longer valid because its backing memory can be > > // reused for whatever purpose. > > pfn_to_page() returns you a virtual address. That virtual address > remains a valid pointer to exactly the same contents, it's just that > the page tables change to point to a different struct page which has > the same compound_head(). I agree with you. Hi Michal, Maybe you need to look at this. -- Yours, Muchun