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=-20.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 56D7CC432BE for ; Wed, 25 Aug 2021 12:11:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F2D25610E6 for ; Wed, 25 Aug 2021 12:11:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F2D25610E6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 7872D8D0001; Wed, 25 Aug 2021 08:11:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 736FD6B0071; Wed, 25 Aug 2021 08:11:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5FE5C8D0001; Wed, 25 Aug 2021 08:11:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0169.hostedemail.com [216.40.44.169]) by kanga.kvack.org (Postfix) with ESMTP id 445D06B006C for ; Wed, 25 Aug 2021 08:11:31 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DB65C250A2 for ; Wed, 25 Aug 2021 12:11:30 +0000 (UTC) X-FDA: 78513488340.02.D3B7662 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 77D61D016E83 for ; Wed, 25 Aug 2021 12:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629893489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k7kAFTtN5GyCnNiW5FdL7RXkuMBaRh4yIij8fQrjUPE=; b=cvVwgxLOZ3PRoBRXn5Mm76+VjojCvUlkNq3Q1pqflDfpRtpAiFrNZUzr1hKv6Ne343r/KE Y8PhRrgORKLav7DKFImX5gFXp/+dTIc7mAL6KZ3MQRMRiq6dyvv9PuZmHisfDeErT36RKe 5i6ItVnsSK4lGDTInTTyDwusDUZOYtw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-77-gTI6Ae31M9CpoByaa_mvQw-1; Wed, 25 Aug 2021 08:11:26 -0400 X-MC-Unique: gTI6Ae31M9CpoByaa_mvQw-1 Received: by mail-wm1-f69.google.com with SMTP id a201-20020a1c7fd2000000b002e748bf0544so2765603wmd.2 for ; Wed, 25 Aug 2021 05:11:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=k7kAFTtN5GyCnNiW5FdL7RXkuMBaRh4yIij8fQrjUPE=; b=OJFWmyZPRid8ycCI6U4mC/WzM/i1Dyp3Tmy/fHMAmpXpKVobz12SH38CFpsirPEFuy x1+Pl+1HLRQUjCLe3n4NB9BBaEQkvC+DEubCwvl3tkGkSzsYuVFK0lFIwXGRMDGilTBF No4C4iFCsO+Uqz0Vtpp/NFtwFQVvxqkTHxY+GcohV3sUMyrP23g+mDMFzTIN7pncMusu x5XSOfc19k0zv8I736EWSgA20VVCLqwCglXWnSJmtuoD4ucbKpFNr1ASLiKCxEbDlPpZ 0/w/mYfIiZH824c31jOo3M8hGItJleIvy7U9/whO2rZ0/fLZMz4rgVADvodG9Y1TioHR UH3Q== X-Gm-Message-State: AOAM532/kqJi11xhUTceKvwlB+8xM8MJrF7dVwnAXEM8gLKb9tAteHo7 vodw0M6Q0nOj3WdVmw1UQa5fEUPeAqSu503lmJW9Gg/ypueGLFKLdSi1K+JpbYPTB9kAVMyA5Ym vWBjLIcCkqIoV8vqkbHRz6FKd1tiB0A3twqRt85yYWrh7X7eWuEZhPbk3ifA= X-Received: by 2002:a05:6000:1241:: with SMTP id j1mr25794383wrx.338.1629893485430; Wed, 25 Aug 2021 05:11:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUWxbQ6sYbcNx3xboKyyUCEav3TMI8aWyQFtR0PKawKvnU4oRlAimZ8U28nYS6NVFVY6bxGg== X-Received: by 2002:a05:6000:1241:: with SMTP id j1mr25794344wrx.338.1629893485099; Wed, 25 Aug 2021 05:11:25 -0700 (PDT) Received: from [192.168.3.132] (p4ff23d6b.dip0.t-ipconnect.de. [79.242.61.107]) by smtp.gmail.com with ESMTPSA id g11sm6329219wrx.30.2021.08.25.05.11.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Aug 2021 05:11:24 -0700 (PDT) Subject: Re: [PATCH 1/4] mm/page_alloc: always initialize memory map for the holes To: Mike Rapoport , Andrew Morton Cc: Michal Simek , Mike Rapoport , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20210714123739.16493-1-rppt@kernel.org> <20210714123739.16493-2-rppt@kernel.org> From: David Hildenbrand Organization: Red Hat Message-ID: <175e0e1e-90cd-5c69-69a3-9f44462679e3@redhat.com> Date: Wed, 25 Aug 2021 14:11:23 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210714123739.16493-2-rppt@kernel.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=cvVwgxLO; spf=none (imf21.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 216.205.24.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 77D61D016E83 X-Stat-Signature: 88dpwnirbm5mtmhdc3c4e5ced8ta7bqg X-HE-Tag: 1629893490-680875 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 14.07.21 14:37, Mike Rapoport wrote: > From: Mike Rapoport > > Currently memory map for the holes is initialized only when SPARSEMEM > memory model is used. Yet, even with FLATMEM there could be holes in the > physical memory layout that have memory map entries. > > For instance, the memory reserved using e820 API on i386 or > "reserved-memory" nodes in device tree would not appear in memblock.memory > and hence the struct pages for such holes will be skipped during memory map > initialization. > > These struct pages will be zeroed because the memory map for FLATMEM > systems is allocated with memblock_alloc_node() that clears the allocated > memory. While zeroed struct pages do not cause immediate problems, the > correct behaviour is to initialize every page using __init_single_page(). > Besides, enabling page poison for FLATMEM case will trigger > PF_POISONED_CHECK() unless the memory map is properly initialized. > > Make sure init_unavailable_range() is called for both SPARSEMEM and FLATMEM > so that struct pages representing memory holes would appear as PG_Reserved > with any memory layout. > > Signed-off-by: Mike Rapoport > --- > mm/page_alloc.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 3b97e17806be..878d7af4403d 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -6624,7 +6624,6 @@ static void __meminit zone_init_free_lists(struct zone *zone) > } > } > > -#if !defined(CONFIG_FLATMEM) > /* > * Only struct pages that correspond to ranges defined by memblock.memory > * are zeroed and initialized by going through __init_single_page() during > @@ -6669,13 +6668,6 @@ static void __init init_unavailable_range(unsigned long spfn, > pr_info("On node %d, zone %s: %lld pages in unavailable ranges", > node, zone_names[zone], pgcnt); > } > -#else > -static inline void init_unavailable_range(unsigned long spfn, > - unsigned long epfn, > - int zone, int node) > -{ > -} > -#endif > > static void __init memmap_init_zone_range(struct zone *zone, > unsigned long start_pfn, > Acked-by: David Hildenbrand -- Thanks, David / dhildenb