From patchwork Sat Dec 5 01:32:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Arcangeli X-Patchwork-Id: 11952713 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=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 B43BFC4361B for ; Sat, 5 Dec 2020 01:32:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F17022DFA for ; Sat, 5 Dec 2020 01:32:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F17022DFA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E874D6B005D; Fri, 4 Dec 2020 20:32:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E38826B0068; Fri, 4 Dec 2020 20:32:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D29B26B006C; Fri, 4 Dec 2020 20:32:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0191.hostedemail.com [216.40.44.191]) by kanga.kvack.org (Postfix) with ESMTP id B6C536B005D for ; Fri, 4 Dec 2020 20:32:49 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 80D8B3636 for ; Sat, 5 Dec 2020 01:32:49 +0000 (UTC) X-FDA: 77557504458.14.quill07_200cd67273c9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin14.hostedemail.com (Postfix) with ESMTP id 5FEA218229837 for ; Sat, 5 Dec 2020 01:32:49 +0000 (UTC) X-HE-Tag: quill07_200cd67273c9 X-Filterd-Recvd-Size: 6214 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Sat, 5 Dec 2020 01:32:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607131968; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pu0zTKndkBixewwk8Qvv8hZiW9lm9BrjATafjEDa54k=; b=IB/hG/mFbxc6+uCj+YUL3g23C7QTIg3i6cIfhTNNaYOssBeU28uOa3o3weF0kJG7S24F2K yb+LORa0CzqyytatHrNeDgflIXT6jpabehIePA+qRbfF3kPblDvbbnkyIHhQdH/cGFLkim QuGXrs9QOckzBYbl82gpCK+qT2bmysM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-410-kMt-KyMCP0i8GfsHXaGpmw-1; Fri, 04 Dec 2020 20:32:45 -0500 X-MC-Unique: kMt-KyMCP0i8GfsHXaGpmw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6D96EC287; Sat, 5 Dec 2020 01:32:44 +0000 (UTC) Received: from mail (ovpn-112-148.rdu2.redhat.com [10.10.112.148]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A73685D9CC; Sat, 5 Dec 2020 01:32:38 +0000 (UTC) From: Andrea Arcangeli To: Andrew Morton , linux-mm@kvack.org Cc: Mike Rapoport Baoquan He <"rppt@kernel.orgbhe"@redhat.com>, David Hildenbrand , Mel Gorman , Michal Hocko , Qian Cai , Vlastimil Babka , linux-kernel@vger.kernel.org Subject: [PATCH 0/1] mm: initialize struct pages in reserved regions outside of the zone ranges Date: Fri, 4 Dec 2020 20:32:37 -0500 Message-Id: <20201205013238.21663-1-aarcange@redhat.com> In-Reply-To: <20201201181502.2340-1-rppt@kernel.org> References: <20201201181502.2340-1-rppt@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: I'm running with these patch applied on all instances as solution to the compaction crashes that started to trigger after the v5.9 upgrade. It's applied on top of https://lore.kernel.org/lkml/20201201181502.2340-1-rppt@kernel.org so that it boots and works fine even when there are memblock.reserved regions that don't overlap with the memblock.memory (as pfn 0 which is in memblock.reserved but not added to memblock.memory). To facilitate any testing: https://git.kernel.org/pub/scm/linux/kernel/git/andrea/aa.git === # grep -A1 -i e820 /proc/iomem 39619000-397f4fff : Unknown E820 type 397f5000-3be55fff : System RAM DMA zone_start_pfn 0 zone_end_pfn() 4096 contiguous 1 DMA32 zone_start_pfn 4096 zone_end_pfn() 1048576 contiguous 0 Normal zone_start_pfn 1048576 zone_end_pfn() 4909056 contiguous 1 Movable zone_start_pfn 0 zone_end_pfn() 0 contiguous 0 235508 0x397f4000 0x4000000000001000 reserved True pfn_valid True 235509 0x397f5000 0x4000000000000000 reserved False pfn_valid True === # grep -A1 -i e820 /proc/iomem 7a17b000-7a216fff : Unknown E820 type 7a217000-7bffffff : System RAM DMA zone_start_pfn 0 zone_end_pfn() 4096 contiguous 1 DMA32 zone_start_pfn 4096 zone_end_pfn() 1048576 contiguous 0 Normal zone_start_pfn 1048576 zone_end_pfn() 4715392 contiguous 1 Movable zone_start_pfn 0 zone_end_pfn() 0 contiguous 0 500246 0x7a216000 0x3fff000000001000 reserved True pfn_valid True 500247 0x7a217000 0x3fff000000000000 reserved False pfn_valid True === I dislike the fix for pfn 0 merged in -mm so that it will still boot with DEBUG_VM=y, posted in https://lkml.kernel.org/r/20201203105107.GR123287@linux.ibm.com, because in addition of looping every 2m from the start at every memblock for every zone in a O(N*2) way, it'll keep assigning a "wrong" zoneid to pfn 0 and it literally reintroduces the problem that https://lore.kernel.org/lkml/20201201181502.2340-1-rppt@kernel.org was meant to solve. This patch implements a more significant change since it alters the zone boundaries. If there's any problem with extending the zone spans to include memblock.reserved regions it'd be good to know now, because if there's no problem with that, I only see benefits in being able to guarantee a proper zoneid and nid of all struct page that are in reserved memblocks too and where reserve_bootmem_region will attempt to call __SetPageReserved later expecting to deal with a "functional" page structure. An alternative to this patch, which still sounds preferable than https://lkml.kernel.org/r/20201203105107.GR123287@linux.ibm.com, is to just teach reserve_bootmem_region not try to set PageReserved on uninitialized PagePoison pages and to learn how to deal with "non functional" page structures, and to just leave them alone. PagePoison conceptually would act as a NO_ZONEID setting in such case and orthogonal with all the rest, it'd be nice if it was set also with DEBUG_VM=n. Overall anything looks preferable than once again assigning a wrong zoneid to a page struct that belongs to a pfn that is not part of the zone in order to boot with the very fix that was meant to prevent such invariant to be broken in the first place. I don't think pfn 0 deserves a magic exception and a pass to break the invariant (even ignoring it may happen that the first pfn in nid > 0 might then also get the pass). Andrea Arcangeli (1): mm: initialize struct pages in reserved regions outside of the zone ranges include/linux/memblock.h | 17 +++++++++--- mm/debug.c | 3 ++- mm/memblock.c | 4 +-- mm/page_alloc.c | 57 ++++++++++++++++++++++++++++++++-------- 4 files changed, 63 insertions(+), 18 deletions(-)