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 C0392C43381 for ; Mon, 21 Dec 2020 18:01:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9986323107 for ; Mon, 21 Dec 2020 18:01:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726031AbgLUSBH (ORCPT ); Mon, 21 Dec 2020 13:01:07 -0500 Received: from mx2.suse.de ([195.135.220.15]:49680 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726010AbgLUSBG (ORCPT ); Mon, 21 Dec 2020 13:01:06 -0500 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: Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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