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.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 A9721C433E0 for ; Thu, 25 Feb 2021 18:41:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A19A64F25 for ; Thu, 25 Feb 2021 18:41:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233578AbhBYSll (ORCPT ); Thu, 25 Feb 2021 13:41:41 -0500 Received: from mx2.suse.de ([195.135.220.15]:55406 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231881AbhBYSji (ORCPT ); Thu, 25 Feb 2021 13:39:38 -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 3F599AC6E; Thu, 25 Feb 2021 18:38:45 +0000 (UTC) To: Mike Rapoport Cc: Mike Rapoport , Andrew Morton , Andrea Arcangeli , Baoquan He , Borislav Petkov , Chris Wilson , David Hildenbrand , "H. Peter Anvin" , Ingo Molnar , Linus Torvalds , =?UTF-8?Q?=c5=81ukasz_Majczak?= , Mel Gorman , Michal Hocko , Qian Cai , "Sarvela, Tomi P" , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, x86@kernel.org References: <20210224153950.20789-1-rppt@kernel.org> <20210224153950.20789-2-rppt@kernel.org> <20210225180521.GH1854360@linux.ibm.com> From: Vlastimil Babka Subject: Re: [PATCH v7 1/1] mm/page_alloc.c: refactor initialization of struct page for holes in memory layout Message-ID: Date: Thu, 25 Feb 2021 19:38:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210225180521.GH1854360@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/25/21 7:05 PM, Mike Rapoport wrote: > On Thu, Feb 25, 2021 at 06:51:53PM +0100, Vlastimil Babka wrote: >> > >> > unset zone link in struct page will trigger >> > >> > VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page); >> >> ... in set_pfnblock_flags_mask() when called with a struct page from the >> "Unknown E820 type" range. > > "... in set_pfnblock_flags_mask() when called with a struct page from a range > other than E820_TYPE_RAM" > > then :) Better :) >> > because there are pages in both ZONE_DMA32 and ZONE_DMA (unset zone link >> > in struct page) in the same pageblock. >> >> I would say "there are apparently pages" ... "and ZONE_DMA does not span this range" > > I'd rephrase it differently, something like > > "because there are pages in the range of ZONE_DMA32 but the unset zone link > in struct page makes them appear as a part of ZONE_DMA" Much better, thanks! >> > Interleave initialization of the unavailable pages with the normal >> > initialization of memory map, so that zone and node information will be >> > properly set on struct pages that are not backed by the actual memory. >> > >> > With this change the pages for holes inside a zone will get proper >> > zone/node links and the pages that are not spanned by any node will get >> > links to the adjacent zone/node. >> >> What if two zones are adjacent? I.e. if the hole was at a boundary between two >> zones. > > What do you mean by "adjacent zones"? If there is a hole near the zone > boundary, zone span would be clamped to exclude the hole. Yeah, zone span should exclude those pages, but you still somehow handle them? That's how I read "pages that are not spanned by any node will get links to the adjacent zone/node." So is it always a unique zone/node can be determined? Let's say we have: ---- pageblock boundary ---- ---- pageblock boundary ---- Now I hope such configurations don't really exist :) But if we simulated them in QEMU, what would be the linkage in struct pages in that hole?