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, 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 B03C0C433E0 for ; Tue, 9 Mar 2021 08:25:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 25C226523B for ; Tue, 9 Mar 2021 08:25:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 25C226523B 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 A9F1C8D00C6; Tue, 9 Mar 2021 03:25:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A747E8D007F; Tue, 9 Mar 2021 03:25:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 963BE8D00C6; Tue, 9 Mar 2021 03:25:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0130.hostedemail.com [216.40.44.130]) by kanga.kvack.org (Postfix) with ESMTP id 7D9218D007F for ; Tue, 9 Mar 2021 03:25:40 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3AE91180AD811 for ; Tue, 9 Mar 2021 08:25:40 +0000 (UTC) X-FDA: 77899652040.03.6DE35EC Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf13.hostedemail.com (Postfix) with ESMTP id F12BCE0011F8 for ; Tue, 9 Mar 2021 08:25:37 +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 57CD8AB8C; Tue, 9 Mar 2021 08:25:38 +0000 (UTC) Date: Tue, 9 Mar 2021 09:25:35 +0100 From: Oscar Salvador To: Dave Hansen Cc: Andrew Morton , David Hildenbrand , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Michal Hocko , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 3/3] x86/vmemmap: Handle unpopulated sub-pmd ranges Message-ID: References: <20210301083230.30924-1-osalvador@suse.de> <20210301083230.30924-4-osalvador@suse.de> <20210308184330.GB25767@linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210308184330.GB25767@linux> X-Stat-Signature: 7ezxkxukntfj8d7yirtpkesiuot99tfx X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: F12BCE0011F8 Received-SPF: none (suse.de>: No applicable sender policy available) receiver=imf13; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1615278337-689942 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, Mar 08, 2021 at 07:43:30PM +0100, Oscar Salvador wrote: > On Thu, Mar 04, 2021 at 09:02:36AM -0800, Dave Hansen wrote: > > Also, logically, it would make a lot of sense if you can move the actual > > PMD freeing logic in here. That way, the caller is just saying, "unuse > > this PMD region", and then this takes care of the rest. As it stands, > > it's a bit weird that the caller takes care of the freeing. > > You mean to move the > > free_hugepage_table(pmd_page(*pmd), altmap); > spin_lock(&init_mm.page_table_lock); > pmd_clear(pmd); > spin_unlock(&init_mm.page_table_lock); > > block in there? > > Well, from where I see it, it is more like: > > if (is_the_range_unused()) > : if so, free everything > > But I agree with you what it might make some sense to move it there. > Since I do not feel strong about this, I will move it. hi Dave, So, after splitting this patch and re-shape it to address all the feedback, I am still not sure about this one. Honestly, I think the freeing logic would be better off kept in remove_pmd_table. The reason for me is that vmemmap_unuse_sub_pmd only 1) marks the range to be removed as unused and 2) checks whether after that, the whole PMD range is unused. I think the confusion comes from the name. "vmemmap_pmd_is_unused" might be a better fit? What do you think? Do you feel strong about moving the log in there regardless of the name? -- Oscar Salvador SUSE L3