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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 DDD55C388F9 for ; Mon, 23 Nov 2020 13:13:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6181F2076E for ; Mon, 23 Nov 2020 13:13:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="BovGW7Do" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6181F2076E Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 598DD6B0075; Mon, 23 Nov 2020 08:13:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 549536B0078; Mon, 23 Nov 2020 08:13:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 437A16B007B; Mon, 23 Nov 2020 08:13:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0021.hostedemail.com [216.40.44.21]) by kanga.kvack.org (Postfix) with ESMTP id 14C706B0075 for ; Mon, 23 Nov 2020 08:13:44 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A20103621 for ; Mon, 23 Nov 2020 13:13:43 +0000 (UTC) X-FDA: 77515725126.12.wood72_0a036fa27365 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 6B3B518055196 for ; Mon, 23 Nov 2020 13:13:43 +0000 (UTC) X-HE-Tag: wood72_0a036fa27365 X-Filterd-Recvd-Size: 4040 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Nov 2020 13:13:42 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1606137221; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rv9w9/llZazFt1Z6bqz4fjM+bsJ8PYyhjd+2a7iwKww=; b=BovGW7DoOC8krOpDGxMAvISB+An1UZdqsVUv0y+mOwCm8gQma8GRfSmZfwYSeLpHtd4a0/ tL9UdmdQTm1PU6J92WQP00NeFdV6eO8Y3Y0lZDPaeByUGaMvOUAdiycCP9E47AAgaodsRu q3uicdbuKCt6m7LZUTwpc+6v7wB2XDg= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 78EB1AC2E; Mon, 23 Nov 2020 13:13:41 +0000 (UTC) Date: Mon, 23 Nov 2020 14:13:39 +0100 From: Michal Hocko To: Matthew Wilcox Cc: Muchun Song , 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 Subject: Re: [External] Re: [PATCH v5 00/21] Free some vmemmap pages of hugetlb page Message-ID: <20201123131339.GO27488@dhcp22.suse.cz> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201123124513.GI4327@casper.infradead.org> 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 23-11-20 12:45:13, 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(). You are right. I have managed to completely confuse myself. Sorry about the noise! -- Michal Hocko SUSE Labs