Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3340514yba; Mon, 6 May 2019 22:49:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvK5dKB900B/wDvmEkHL0x4Ov/tdu8b+pEHpU3782LTAXyaZ4ztFAsXeCjieXyGQQm1AtQ X-Received: by 2002:a17:902:2962:: with SMTP id g89mr37745930plb.190.1557208182527; Mon, 06 May 2019 22:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557208182; cv=none; d=google.com; s=arc-20160816; b=G2GM3rZeKyRUeM8Q8z+GwnL7N0tFunoXpUFjTyoyvXS1YS5SYxztbQiF4uVPQT7xOC pH4PVKI1zeOsDfFeQ0hmpeCAsiOjW9qP62XFgA6oCa0NjRsszgHwUJSd2Wbkb5SV0n32 a5lGUC66h9DmA+tSdyx7Fh/MVexS0HBEX58wI3VXJ8Tj9t0LAE694Jn2+zD8j05I8D3n 4fWLpPxQp8IdXyAUbarucdZ6Ln3I9ZUXP3R1uaC8YHJ8Y2r49UdREkuPKTMgUERwi7Gg q1PH60JyiOUVHpQetGY1+3WOreKjnIjp31t5uhSFEDgOwrBO0Dmbe5GMYuRAjXqHpw3C j03A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pMrSWKQu3YJDZWB1FILG46dQwF92H/0EQLiS6uJmPcs=; b=RAYoh7jyJNnaPbdVRbWgNQhdTHlAwFW2PWexD2T5lwIlCZrRSStHWz6OrLpnEfYffu Di0530gEdLMajFpNJQK9yxR3ra2McFvN4x0CQTSJn9GsOpSU30HXqjG8uWVye248z1Rv BmU5By9oMzBhXjHynYACLP54Bg+i/8u0HUyWmYZ7YRfGlNCx+FIK2XK2K3V8l5n9r8Kn EJhy+zHHTp86jGXwDJXio9FK107uGipF8Eve5bmgCTM7IlZ4N9FYg9KnN0nZTU2Lsqb9 NkzIstevbCaSVjgVeh9pDVW9MJETvOQn+AQhB2mH0xgF26zGhvt+456Q00bt5tTUIxFg aNUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eMYCK3wt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v18si9857490plo.114.2019.05.06.22.49.27; Mon, 06 May 2019 22:49:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eMYCK3wt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729157AbfEGFkm (ORCPT + 99 others); Tue, 7 May 2019 01:40:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:60086 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729136AbfEGFki (ORCPT ); Tue, 7 May 2019 01:40:38 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A5A4A20578; Tue, 7 May 2019 05:40:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557207637; bh=pNoHONEm1X9opg3xl9NbGvRfo6Og1Tx2dproK5eTanU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eMYCK3wtrE7IvV0gQzSlZL/zBwGU4POxkmXUxvS/CdJf6YshP3/f0idjABTj0iA64 Iz/DycLKqufCQCaVgTKDvSnX9BWVy/jhwjEioqkb1+LBobrBFintNYnINk+M7XzyNb aWViDuA0uxQNKoRQh+DsCTFWlt4vRo7VCCxisSgs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Michal Hocko , Robert Shteynfeld , stable@kernel.org, Linus Torvalds , Sasha Levin , linux-mm@kvack.org Subject: [PATCH AUTOSEL 4.14 71/95] Revert "mm, memory_hotplug: initialize struct pages for the full memory section" Date: Tue, 7 May 2019 01:38:00 -0400 Message-Id: <20190507053826.31622-71-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190507053826.31622-1-sashal@kernel.org> References: <20190507053826.31622-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Hocko [ Upstream commit 4aa9fc2a435abe95a1e8d7f8c7b3d6356514b37a ] This reverts commit 2830bf6f05fb3e05bc4743274b806c821807a684. The underlying assumption that one sparse section belongs into a single numa node doesn't hold really. Robert Shteynfeld has reported a boot failure. The boot log was not captured but his memory layout is as follows: Early memory node ranges node 1: [mem 0x0000000000001000-0x0000000000090fff] node 1: [mem 0x0000000000100000-0x00000000dbdf8fff] node 1: [mem 0x0000000100000000-0x0000001423ffffff] node 0: [mem 0x0000001424000000-0x0000002023ffffff] This means that node0 starts in the middle of a memory section which is also in node1. memmap_init_zone tries to initialize padding of a section even when it is outside of the given pfn range because there are code paths (e.g. memory hotplug) which assume that the full worth of memory section is always initialized. In this particular case, though, such a range is already intialized and most likely already managed by the page allocator. Scribbling over those pages corrupts the internal state and likely blows up when any of those pages gets used. Reported-by: Robert Shteynfeld Fixes: 2830bf6f05fb ("mm, memory_hotplug: initialize struct pages for the full memory section") Cc: stable@kernel.org Signed-off-by: Michal Hocko Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/page_alloc.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 16c20d9e771f..923deb33bf34 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5348,18 +5348,6 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, __init_single_pfn(pfn, zone, nid); } } -#ifdef CONFIG_SPARSEMEM - /* - * If the zone does not span the rest of the section then - * we should at least initialize those pages. Otherwise we - * could blow up on a poisoned page in some paths which depend - * on full sections being initialized (e.g. memory hotplug). - */ - while (end_pfn % PAGES_PER_SECTION) { - __init_single_page(pfn_to_page(end_pfn), end_pfn, zone, nid); - end_pfn++; - } -#endif } static void __meminit zone_init_free_lists(struct zone *zone) -- 2.20.1