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=-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 BF502C433E0 for ; Tue, 16 Feb 2021 08:41:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D77264DAF for ; Tue, 16 Feb 2021 08:41:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229894AbhBPIkA (ORCPT ); Tue, 16 Feb 2021 03:40:00 -0500 Received: from mx2.suse.de ([195.135.220.15]:53616 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbhBPIeK (ORCPT ); Tue, 16 Feb 2021 03:34:10 -0500 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=1613464402; 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=TYbPMLrBD6Kvf/snb6pPAKbE9WPqesCCNFflje30gLY=; b=QFxKo3EaJf8BeUaY2v10WY4ktuKCaS5O0G3CvfmRrppIF/GQ4HXnWdKAdtz1bWOeQgZFKt jyBxioISY5bu+tCBpQO6DaskeKBD48uTmMq0216hxINNwIKY8CLSn1ftMF+aUsh1Z78gBy Uq44aCT9Yf14TpUtTWiLfldo132z628= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E0907AD29; Tue, 16 Feb 2021 08:33:21 +0000 (UTC) Date: Tue, 16 Feb 2021 09:33:20 +0100 From: Michal Hocko To: Mike Rapoport Cc: Mel Gorman , David Hildenbrand , Andrew Morton , Andrea Arcangeli , Baoquan He , Borislav Petkov , Chris Wilson , "H. Peter Anvin" , Ingo Molnar , Linus Torvalds , =?utf-8?Q?=C5=81ukasz?= Majczak , Mike Rapoport , Qian Cai , "Sarvela, Tomi P" , Thomas Gleixner , Vlastimil Babka , linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v5 1/1] mm: refactor initialization of struct page for holes in memory layout Message-ID: References: <20210208110820.6269-1-rppt@kernel.org> <20210214180016.GO242749@kernel.org> <20210215212440.GA1307762@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210215212440.GA1307762@kernel.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 15-02-21 23:24:40, Mike Rapoport wrote: > On Mon, Feb 15, 2021 at 10:00:31AM +0100, Michal Hocko wrote: > > On Sun 14-02-21 20:00:16, Mike Rapoport wrote: > > > On Fri, Feb 12, 2021 at 02:18:20PM +0100, Michal Hocko wrote: > > > > > We can correctly set the zone links for the reserved pages for holes in the > > > middle of a zone based on the architecture constraints and with only the > > > holes in the beginning/end of the memory will be not spanned by any > > > node/zone which in practice does not seem to be a problem as the VM_BUG_ON > > > in set_pfnblock_flags_mask() never triggered on pfn 0. > > > > I really fail to see what you mean by correct zone/node for a memory > > range which is not associated with any real node. > > We know architectural zone constraints, so we can have always have 1:1 > match from pfn to zone. Node indeed will be a guess. That is true only for some zones. Also we do require those to be correct when the memory is managed by the page allocator. I believe we can live with incorrect zones when they are in holes. > > > > I am sorry, I haven't followed previous discussions. Has the removal of > > > > the VM_BUG_ON been considered as an immediate workaround? > > > > > > It was never discussed, but I'm not sure it's a good idea. > > > > > > Judging by the commit message that introduced the VM_BUG_ON (commit > > > 86051ca5eaf5 ("mm: fix usemap initialization")) there was yet another > > > inconsistency in the memory map that required a special care. > > > > Can we actually explore that path before adding yet additional > > complexity and potentially a very involved fix for a subtle problem? > > This patch was intended as a fix for inconsistency of the memory map that > is the root cause for triggering this VM_BUG_ON and other corner case > problems. > > The previous version [1] is less involved as it does not extend node/zone > spans. I do understand that. And I am not objecting to the patch. I have to confess I haven't digested it yet. Any changes to early memory intialization have turned out to be subtle and corner cases only pop up later. This is almost impossible to review just by reading the code. That's why I am asking whether we want to address the specific VM_BUG_ON first with something much less tricky and actually reviewable. And that's why I am asking whether dropping the bug_on itself is safe to do and use as a hot fix which should be easier to backport. Longterm I am definitely supporting any change which will lead to a fully initialized state. Whatever that means. One option would be to simply never allow partial page blocks or even memory sections. This would waste some memory but from what I have seen so far this would be quite small amount on very rare setups. So it might turn out as a much more easier and maintainable way forward. > [1] https://lore.kernel.org/lkml/20210130221035.4169-3-rppt@kernel.org > -- > Sincerely yours, > Mike. -- Michal Hocko SUSE Labs