Received: by 10.223.185.116 with SMTP id b49csp7408562wrg; Thu, 1 Mar 2018 05:11:30 -0800 (PST) X-Google-Smtp-Source: AG47ELtBaVTHb+8OqL+6dFs4DJJnr3jC1JalmNr9HbZN9r0s+8o7ZwdEiLZyQ62HSXp2362DYJZX X-Received: by 10.98.200.131 with SMTP id i3mr1940938pfk.40.1519909890599; Thu, 01 Mar 2018 05:11:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519909890; cv=none; d=google.com; s=arc-20160816; b=nv4ZDUOake5sA0XLmQMPRRXHVTTjODUZJdRfr+EyV1sMdUxDlPoOsVWDQ5q+emon7Q +7gQKHf5G47Gb5Xa1daLzMJSdgs9FwDaby4/mvQ01PaI11brEoEFsklOBn+ICp9YELph WkIlKdHtMN8lCSZkdDP0YpecFRSYKZprGy1d/wa59tOtogXNasewfW06B8E1cEMhti5K SlP2MCIVp8Lq39W9ej3hQDyByZ7p96PYAEmPfyH+VmyyBFeAGWnSP0ADY4iHTDM8Stsy xiV2CjmUys1Pd/cn4CGNYdebmnnVpuLMg89SXKnBwY54mv4H+HUQBAXZJ6D/3b9+SqO8 mZdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=XQCubfdYrK/ST6FDmyzUsJk77uK9egw4DaIoUhSLWIQ=; b=0fsl8UFn/4oDOqc8GueakrrguO4sk0zyXMRlCrN9oIglxKeqTKRmubLGusgoCdCUWA yM3k2pk/zM9AckyaStTNikLIpcsjiVxABPrBckwgvMMhZV2ytMmXJi7K2pNQUJM6oEiQ PiMZR5Ft+Cp4mgq0+9lceMpzSc4A3Hf9mHNT6eh7WDgvhwrp/ZvStWOG1bueTjPxgSpB qMDWVzELZqqbstTAjTi6wd7JaNGlL2iIc19qk7twHoKVpLjE2YjPBxFwnts5iW7q7s5B 2uFNkjObxMKSt1IbZi8NZRdO4Tz/XLorpDv+896Xg9JTp5uzMLcs0Y0y4n95m1JL6Syw SZTQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6-v6si3138400plj.126.2018.03.01.05.11.15; Thu, 01 Mar 2018 05:11:30 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030618AbeCANKh (ORCPT + 99 others); Thu, 1 Mar 2018 08:10:37 -0500 Received: from mx2.suse.de ([195.135.220.15]:56265 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030517AbeCANKg (ORCPT ); Thu, 1 Mar 2018 08:10:36 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6A11AABEA; Thu, 1 Mar 2018 13:10:34 +0000 (UTC) Date: Thu, 1 Mar 2018 14:10:33 +0100 From: Michal Hocko To: Daniel Vacek Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Vlastimil Babka , Mel Gorman , Pavel Tatashin , Paul Burton , stable@vger.kernel.org Subject: Re: [PATCH] mm/page_alloc: fix memmap_init_zone pageblock alignment Message-ID: <20180301131033.GH15057@dhcp22.suse.cz> References: <1519908465-12328-1-git-send-email-neelx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1519908465-12328-1-git-send-email-neelx@redhat.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 01-03-18 13:47:45, Daniel Vacek wrote: > 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. This changelog doesn't describe how the fix works. Why doesn't memblock_next_valid_pfn return the first valid pfn as one would expect? It would be also good put the panic info in the changelog. > 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 > -- Michal Hocko SUSE Labs