Received: by 10.223.185.116 with SMTP id b49csp7385929wrg; Thu, 1 Mar 2018 04:51:07 -0800 (PST) X-Google-Smtp-Source: AG47ELsYMuw8eI6Ya5XaNJ+7+MtpxqrSJpEEwROdEnu1Os7NpLSScMyNN4XhKLmuwOQ/opLrMnRi X-Received: by 10.98.103.69 with SMTP id b66mr1870779pfc.114.1519908667566; Thu, 01 Mar 2018 04:51:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519908667; cv=none; d=google.com; s=arc-20160816; b=S+RYINliFnkOFZvkinc4HvGLhNdffDqju9zGXcYOMMo8c7LYFcczpauYCpaZGwe/Ei wIVeYpkFWoD4pAvq5dgrEhUgDD0zMVfSe+COzdXcdYpGMHpq5wwU7P4yWoHpiiK7a52e dNnKq4RrCIm6xdbwd80hHGSJydjYetO1e3Rfrpkj8REjfVpA6J7BEDin0TYhQrDM84jv PpFpL18WkeOk2Ql05wMn3YqlDIYGTC00SHMZAkavw5UjtzqcmZeIKYe9RACAKDKsdfFn esKgjtVx3b37Gs13SuEYObKWBUBdXpCWSmb8G41OQSdCNil4BFui0H+oVF1f/szFJlig 7F/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=jSrjkyWZAp067yqj6RfzXfag4nhzvG7DS6py7o2dDP0=; b=XCPezldQToyP+e8AZAWf88EPuvUcUTGO5vsz75mJ9K19uPNsjNaf4kCTm1PZGrVZno 6SsZTKbE9nSEXSLbuFbZmQWA6Ovy0EU7zkgjETQJBYzTZQ/mhsjXKoc4mxTIx+IY+3rx bkXEsTiOlajwMtTIrBbsImgJDd8NXwiiMCWsVIUq3YXf36+aAfGsPz/cxX/HyIXIUW2D 9xlxJTt/B4/ESmkCnvxqnCPKOM8mIVbz8vc+TGD0Srh4pQRQ5IpsaLECyb5309nZs9jK TdzB8EWF4u3tfABqQ/5kDakowFcuZLjIL2qDCnNhMHNRRlR5vwx1w2TTjYME4pKefKKt rYSQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v65si2907358pfk.338.2018.03.01.04.50.51; Thu, 01 Mar 2018 04:51:07 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030493AbeCAMsz (ORCPT + 99 others); Thu, 1 Mar 2018 07:48:55 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59676 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030347AbeCAMsx (ORCPT ); Thu, 1 Mar 2018 07:48:53 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A529680AD238; Thu, 1 Mar 2018 12:48:52 +0000 (UTC) Received: from slurm.brq.redhat.com (dhcp-26-122.brq.redhat.com [10.34.26.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F4DE215671B; Thu, 1 Mar 2018 12:48:50 +0000 (UTC) From: Daniel Vacek To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , Michal Hocko , Vlastimil Babka , Mel Gorman , Pavel Tatashin , Paul Burton , Daniel Vacek , stable@vger.kernel.org Subject: [PATCH] mm/page_alloc: fix memmap_init_zone pageblock alignment Date: Thu, 1 Mar 2018 13:47:45 +0100 Message-Id: <1519908465-12328-1-git-send-email-neelx@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 01 Mar 2018 12:48:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 01 Mar 2018 12:48:52 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'neelx@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In move_freepages() a BUG_ON() can be triggered on uninitialized page structures due to pageblock alignment. Aligning the skipped pfns in memmap_init_zone() the same way as in move_freepages_block() simply fixes those crashes. Fixes: b92df1de5d28 ("[mm] page_alloc: skip over regions of invalid pfns where possible") Signed-off-by: Daniel Vacek Cc: stable@vger.kernel.org --- mm/page_alloc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index cb416723538f..9edee36e6a74 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5359,9 +5359,14 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, /* * Skip to the pfn preceding the next valid one (or * end_pfn), such that we hit a valid pfn (or end_pfn) - * on our next iteration of the loop. + * on our next iteration of the loop. Note that it needs + * to be pageblock aligned even when the region itself + * is not as move_freepages_block() can shift ahead of + * the valid region but still depends on correct page + * metadata. */ - pfn = memblock_next_valid_pfn(pfn, end_pfn) - 1; + pfn = (memblock_next_valid_pfn(pfn, end_pfn) & + ~(pageblock_nr_pages-1)) - 1; #endif continue; } -- 2.16.2