Received: by 10.213.65.68 with SMTP id h4csp1609572imn; Thu, 15 Mar 2018 04:54:00 -0700 (PDT) X-Google-Smtp-Source: AG47ELuoWWNwvrBegCs6/MvrU/WlhOSCOzhjGUvx+B5SPh5yY5NX9rzE7QnWJaFrxaMpp4AYDTUA X-Received: by 10.98.64.146 with SMTP id f18mr7552916pfd.30.1521114840227; Thu, 15 Mar 2018 04:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521114840; cv=none; d=google.com; s=arc-20160816; b=hp2/iURYWupi/K9jTLRY8+K/pJxw5tQg02/hRrkw51nZ/7E15mBFC1PjwgXhduG9jb 1FMqW6w0mxpmCR4cc2Y1QM0wlRIyxCzR43RhvhYyRis9tNtVFaRlRHKKEnbOZovSQPPo 2F4EfDq4ANe7SI1Gw3BBew4opp8Naj25BbW4PiDbyhDTP7UQ+JKohZhibKmAP1/qdmJF fZw6Viv+n5An/Bpx667bgpEJhr2hZ0A7NBo6uoH1mkOIpiQrswIAQ3iS4dXhRkCLCjd7 G2pgQVbqIdkIrPUp9hi7hyBNJdrQSZjWcRINLCZ8tT22Nr8npvM4L/bZVJ9IYTID0Bp3 lm7Q== 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=Qs4u2jUIuuzbiZ7S/frBHQFDBeJycxZluCHdYWk6Pzs=; b=VacBVWXMnwukPkEJxdgWZhTsPhk0cKFkpFei1nCQ6nnfwAXKBgNcg0SI8Xoc/3Wfe/ aI3y0sJ9fHrXZ4t21SRwsH46XCmlwfIjWEUL/jqtGQeVuqvywi7wlhZQoQJirTFmhKTL H/Xj7VNRaSW3Du6ZntIJUv3RfDsrtDjn+jHmiXB23eN8PtZEfVrvmAWgTb9x4xKGqiEp X1ar4OhgdyIJDeWk3bYvxLBZqKXjVlffUizZ6Qd1hXXUFPIGZPF1wBxtbKu/Pg10CP3f ezYir49Upa2h+3c0DbLRsazNeVFiiXwY8Bl8ypH7WfGg7+P5fc23mTyThLkwyU/IaOG0 ck0g== 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 f125si3298839pgc.736.2018.03.15.04.53.43; Thu, 15 Mar 2018 04:54:00 -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; 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 S1751762AbeCOLu7 (ORCPT + 99 others); Thu, 15 Mar 2018 07:50:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:60769 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750726AbeCOLu5 (ORCPT ); Thu, 15 Mar 2018 07:50:57 -0400 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 C5C72ACDC; Thu, 15 Mar 2018 11:50:55 +0000 (UTC) Date: Thu, 15 Mar 2018 12:50:55 +0100 From: Michal Hocko To: Daniel Vacek Cc: Naresh Kamboju , Sudeep Holla , Ard Biesheuvel , open list , linux-mm@kvack.org, Andrew Morton , Mel Gorman , Paul Burton , Pavel Tatashin , Vlastimil Babka , stable Subject: Re: [PATCH] mm/page_alloc: fix boot hang in memmap_init_zone Message-ID: <20180315115055.GD23100@dhcp22.suse.cz> References: <20180313224240.25295-1-neelx@redhat.com> <20180314141727.GE23100@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 15-03-18 02:30:41, Daniel Vacek wrote: > On Wed, Mar 14, 2018 at 3:17 PM, Michal Hocko wrote: > > On Tue 13-03-18 23:42:40, Daniel Vacek wrote: > >> On some architectures (reported on arm64) commit 864b75f9d6b01 ("mm/page_alloc: fix memmap_init_zone pageblock alignment") > >> causes a boot hang. This patch fixes the hang making sure the alignment > >> never steps back. > > > > I am sorry to be complaining again, but the code is so obscure that I > > No worries, I'm glad for any review. Which code exactly you do find > obscure? This patch or my former fix or the original commit > introducing memblock_next_valid_pfn()? Coz I'd agree the original > commit looks pretty obscure... As mentioned in the other email, the whole going back and forth in the same loop is just too ugly to live. > > would _really_ appreciate some more information about what is going > > on here. memblock_next_valid_pfn will most likely return a pfn within > > the same memblock and the alignment will move it before the old pfn > > which is not valid - so the block has some holes. Is that correct? > > I do not understand what you mean by 'pfn within the same memblock'? Sorry, I should have said in the same pageblock > And by 'the block has some holes'? memblock_next_valid_pfn clearly returns pfn which is within a pageblock and that is why we do not initialize pages in the begining of the block while move_freepages_block does really expect the full pageblock to be initialized properly. That is the fundamental problem, right? > memblock has types 'memory' (as usable memory) and 'reserved' (for > unusable mem), if I understand correctly. We might not have struct pages for invalid pfns. That really depends on the memory mode. Sure sparse mem model will usually allocate struct pages for whole memory sections but that is not universally true and adding such a suble assumption is simply wrong. I suspect you are making strong assumptions based on a very specific implementation which might be not true in general. That was the feeling I've had since the patch was proposed for the first time. This is such a cluttered area that I am not really sure myself, thoug. -- Michal Hocko SUSE Labs