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 07F0AC433E0 for ; Thu, 25 Feb 2021 18:38:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 65C1B64FB1 for ; Thu, 25 Feb 2021 18:38:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 65C1B64FB1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D91D16B0006; Thu, 25 Feb 2021 13:38:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D42906B006C; Thu, 25 Feb 2021 13:38:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C57986B006E; Thu, 25 Feb 2021 13:38:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0027.hostedemail.com [216.40.44.27]) by kanga.kvack.org (Postfix) with ESMTP id B1D576B0006 for ; Thu, 25 Feb 2021 13:38:47 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 80612181B04A1 for ; Thu, 25 Feb 2021 18:38:47 +0000 (UTC) X-FDA: 77857651494.30.AA75DB5 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf29.hostedemail.com (Postfix) with ESMTP id E8558E4 for ; Thu, 25 Feb 2021 18:38:46 +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 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 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: E8558E4 X-Stat-Signature: iuczrhc7dy6781dxxpgepcc3wyodoht7 Received-SPF: none (suse.cz>: No applicable sender policy available) receiver=imf29; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1614278326-743128 Content-Transfer-Encoding: quoted-printable 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 2/25/21 7:05 PM, Mike Rapoport wrote: > On Thu, Feb 25, 2021 at 06:51:53PM +0100, Vlastimil Babka wrote: >> >=20 >> > unset zone link in struct page will trigger >> >=20 >> > VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page); >>=20 >> ... in set_pfnblock_flags_mask() when called with a struct page from t= he >> "Unknown E820 type" range. >=20 > "... in set_pfnblock_flags_mask() when called with a struct page from a= range > other than E820_TYPE_RAM" >=20 > then :) Better :) >> > because there are pages in both ZONE_DMA32 and ZONE_DMA (unset zone = link >> > in struct page) in the same pageblock. >>=20 >> I would say "there are apparently pages" ... "and ZONE_DMA does not sp= an this range" >=20 > I'd rephrase it differently, something like >=20 > "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 memor= y. >> >=20 >> > 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. >>=20 >> What if two zones are adjacent? I.e. if the hole was at a boundary bet= ween two >> zones. >=20 > 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?