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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,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 B2CDFECE587 for ; Mon, 14 Oct 2019 09:31:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6517620659 for ; Mon, 14 Oct 2019 09:31:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6517620659 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 E1C3B8E0005; Mon, 14 Oct 2019 05:31:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DCB628E0001; Mon, 14 Oct 2019 05:31:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE2E68E0005; Mon, 14 Oct 2019 05:31:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0143.hostedemail.com [216.40.44.143]) by kanga.kvack.org (Postfix) with ESMTP id ABB758E0001 for ; Mon, 14 Oct 2019 05:31:20 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 65CA9A2BD for ; Mon, 14 Oct 2019 09:31:20 +0000 (UTC) X-FDA: 76041871920.30.bone13_45ca0c13a9737 X-HE-Tag: bone13_45ca0c13a9737 X-Filterd-Recvd-Size: 3303 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Mon, 14 Oct 2019 09:31:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2DDB03082E24; Mon, 14 Oct 2019 09:31:18 +0000 (UTC) Received: from [10.36.116.28] (ovpn-116-28.ams2.redhat.com [10.36.116.28]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4890F5C1D4; Mon, 14 Oct 2019 09:31:15 +0000 (UTC) Subject: Re: [PATCH v6 03/10] mm/memory_hotplug: Don't access uninitialized memmaps in shrink_pgdat_span() To: linux-kernel@vger.kernel.org, Andrew Morton Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, x86@kernel.org, Oscar Salvador , Michal Hocko , Pavel Tatashin , Dan Williams , Wei Yang , "Aneesh Kumar K . V" References: <20191006085646.5768-1-david@redhat.com> <20191006085646.5768-4-david@redhat.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <3d8be627-bfd6-1336-689d-345a2ed67118@redhat.com> Date: Mon, 14 Oct 2019 11:31:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <20191006085646.5768-4-david@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 14 Oct 2019 09:31:18 +0000 (UTC) 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 06.10.19 10:56, David Hildenbrand wrote: > We might use the nid of memmaps that were never initialized. For > example, if the memmap was poisoned, we will crash the kernel in > pfn_to_nid() right now. Let's use the calculated boundaries of the separate > zones instead. This now also avoids having to iterate over a whole bunch of > subsections again, after shrinking one zone. > > Before commit d0dc12e86b31 ("mm/memory_hotplug: optimize memory > hotplug"), the memmap was initialized to 0 and the node was set to the > right value. After that commit, the node might be garbage. > > We'll have to fix shrink_zone_span() next. > > Cc: Andrew Morton > Cc: Oscar Salvador > Cc: David Hildenbrand > Cc: Michal Hocko > Cc: Pavel Tatashin > Cc: Dan Williams > Cc: Wei Yang > Fixes: d0dc12e86b31 ("mm/memory_hotplug: optimize memory hotplug") @Andrew, can you convert that to Fixes: f1dd2cd13c4b ("mm, memory_hotplug: do not associate hotadded memory to zones until online") # visible after d0dc12e86b319 and add Cc: stable@vger.kernel.org # v4.13+ -- Thanks, David / dhildenb