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.7 required=3.0 tests=BAYES_00, 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 59814C433DB for ; Mon, 21 Dec 2020 18:00:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D15ED20786 for ; Mon, 21 Dec 2020 18:00:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D15ED20786 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 09C786B005C; Mon, 21 Dec 2020 13:00:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 074196B005D; Mon, 21 Dec 2020 13:00:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECB656B0068; Mon, 21 Dec 2020 13:00:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0164.hostedemail.com [216.40.44.164]) by kanga.kvack.org (Postfix) with ESMTP id D50796B005C for ; Mon, 21 Dec 2020 13:00:27 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 31D63813E for ; Mon, 21 Dec 2020 18:00:27 +0000 (UTC) X-FDA: 77618054094.27.toe39_470705e27459 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id ECBFC3D668 for ; Mon, 21 Dec 2020 18:00:26 +0000 (UTC) X-HE-Tag: toe39_470705e27459 X-Filterd-Recvd-Size: 3522 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Dec 2020 18:00:26 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 99C07AD09; Mon, 21 Dec 2020 18:00:24 +0000 (UTC) Date: Mon, 21 Dec 2020 19:00:19 +0100 From: Oscar Salvador To: Muchun Song 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 , Michal Hocko , "Song Bao Hua (Barry Song)" , David Hildenbrand , naoya.horiguchi@nec.com, Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel Subject: Re: [External] Re: [PATCH v10 03/11] mm/hugetlb: Free the vmemmap pages associated with each HugeTLB page Message-ID: <20201221180019.GA2884@localhost.localdomain> References: <20201217121303.13386-1-songmuchun@bytedance.com> <20201217121303.13386-4-songmuchun@bytedance.com> <20201221091123.GB14343@linux> <20201221134345.GA19324@linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Dec 21, 2020 at 11:52:30PM +0800, Muchun Song wrote: > On Mon, Dec 21, 2020 at 9:44 PM Oscar Salvador wrote: > > > > On Mon, Dec 21, 2020 at 07:25:15PM +0800, Muchun Song wrote: > > > > > Should we add a BUG_ON in vmemmap_remap_free() for now? > > > > > > BUG_ON(reuse != start + PAGE_SIZE); > > > > I do not think we have to, plus we would be BUG_ing for some specific use > > case in "generic" function. > > The vmemmap_remap_range() walks page table range [start, end), > if reuse is equal to (start + PAGE_SIZE), the range can adjust to > [start - PAGE_SIZE, end). But if not, we need some work to > implement the "generic" function. > > - adjust range to [min(start, reuse), end) and call > vmemmap_remap_rangeand which skip the hole > which is [reuse + PAGE_SIZE, start) or [end, reuse). > - call vmemmap_remap_range(reuse, reuse + PAGE_SIZE) > to get the reuse page.Then, call vmemmap_remap_range(start, end) > again to remap. > > Which one do you prefer? I would not overcomplicate things at this stage. Just follow my sugestion and add a BUG_ON as you said, that might be the easier way now. We can overthink this in the future when some other usecases come around, right? Thanks -- Oscar Salvador SUSE L3