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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 A5608C4727C for ; Wed, 30 Sep 2020 03:13:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2F0D920773 for ; Wed, 30 Sep 2020 03:13:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="pcQTc4aA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F0D920773 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 879E3900002; Tue, 29 Sep 2020 23:13:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 82DAF6B005D; Tue, 29 Sep 2020 23:13:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 71AC7900002; Tue, 29 Sep 2020 23:13:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id 5D5CE6B005C for ; Tue, 29 Sep 2020 23:13:46 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 20C0D8249980 for ; Wed, 30 Sep 2020 03:13:46 +0000 (UTC) X-FDA: 77318258052.22.eyes38_44042082718f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id E884218038E60 for ; Wed, 30 Sep 2020 03:13:45 +0000 (UTC) X-HE-Tag: eyes38_44042082718f X-Filterd-Recvd-Size: 4018 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Wed, 30 Sep 2020 03:13:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ZdPsP/+B1OF420qqHgB+/SxMYEAFyf2O+eNfuVQ7neg=; b=pcQTc4aAZnW0R9sFBt3cL+TWW2 UFhibNgovuZb7lVeEiW2VQuRLrhkVRCtOGu38lpi0Fq6INx3+iPr0GodqLPFtavq3SO5mhE43/8Pw zOjjZ/Z2WJQ82xE6yTM5fRoFCKT9fGUOi0mtn3dJafoT97dd1gXtp45WIGdjGtojk8lO+FX/+S995 laKMTXrPutRO2RM92p3K6qygPeAG25AuxdGkf11idsufBTPq/lPyXh1re1B9bl4GDDtsoqSr69KGS 6E5A8/HBI10VK3Pd69FxUmPhZjco+K3tav8KBqQ3HUTDZus1LC4TnmhplcQ0k+G6NNP9qKuwCiJBB 38GQyy+g==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kNSYB-0008Ti-S1; Wed, 30 Sep 2020 03:13:04 +0000 Date: Wed, 30 Sep 2020 04:13:03 +0100 From: Matthew Wilcox To: Mike Kravetz Cc: Muchun Song , corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, rdunlap@infradead.org, oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, almasrymina@google.com, rientjes@google.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: Re: [RFC PATCH 00/24] mm/hugetlb: Free some vmemmap pages of hugetlb page Message-ID: <20200930031303.GN20115@casper.infradead.org> References: <20200915125947.26204-1-songmuchun@bytedance.com> <31eac1d8-69ba-ed2f-8e47-d957d6bb908c@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <31eac1d8-69ba-ed2f-8e47-d957d6bb908c@oracle.com> 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 Tue, Sep 29, 2020 at 02:58:18PM -0700, Mike Kravetz wrote: > On 9/15/20 5:59 AM, Muchun Song wrote: > > Hi all, > > > > This patch series will free some vmemmap pages(struct page structures) > > associated with each hugetlbpage when preallocated to save memory. > ... > > The mapping of the first page(index 0) and the second page(index 1) is > > unchanged. The remaining 6 pages are all mapped to the same page(index > > 1). So we only need 2 pages for vmemmap area and free 6 pages to the > > buddy system to save memory. Why we can do this? Because the content > > of the remaining 7 pages are usually same except the first page. > > > > When a hugetlbpage is freed to the buddy system, we should allocate 6 > > pages for vmemmap pages and restore the previous mapping relationship. > > > > If we uses the 1G hugetlbpage, we can save 4095 pages. This is a very > > substantial gain. On our server, run some SPDK applications which will > > use 300GB hugetlbpage. With this feature enabled, we can save 4797MB > > memory. > > At a high level this seems like a reasonable optimization for hugetlb > pages. It is possible because hugetlb pages are 'special' and mostly > handled differently than pages in normal mm paths. > > The majority of the new code is hugetlb specific, so it should not be > of too much concern for the general mm code paths. I'll start looking > closer at the series. However, if someone has high level concerns please > let us know. The only 'potential' conflict I am aware of is discussion > about support of double mapping hugetlb pages. Not on x86, but architectures which have dcache coherency issues sometimes use PG_arch_1 on the subpages. I think it would be wise to map pages 1-7 read-only to catch this, as well as any future change which causes subpage bits to get set.