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.5 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 343CEC432C0 for ; Wed, 20 Nov 2019 07:52:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0165820872 for ; Wed, 20 Nov 2019 07:52:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0165820872 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 90F3D6B0005; Wed, 20 Nov 2019 02:52:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C0546B0006; Wed, 20 Nov 2019 02:52:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D6246B0007; Wed, 20 Nov 2019 02:52:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0165.hostedemail.com [216.40.44.165]) by kanga.kvack.org (Postfix) with ESMTP id 682EC6B0005 for ; Wed, 20 Nov 2019 02:52:13 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 2DA06180AD815 for ; Wed, 20 Nov 2019 07:52:13 +0000 (UTC) X-FDA: 76175887746.19.test54_30700c1e2fa1c X-HE-Tag: test54_30700c1e2fa1c X-Filterd-Recvd-Size: 4348 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by imf40.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Nov 2019 07:52:12 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id b3so26894816wrs.13 for ; Tue, 19 Nov 2019 23:52:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=SuCP5JTI0E4nMP2UPf/N4wvDe3O4fmtrt4QcYh19UfQ=; b=jlxbTt4+ubD+mdH0RzJlRlXFuzrvaRtZvF2vr3P0TRX0hPPAHeqjxkWNQhhYOYmaJE 3zueOcQ3eXyTWlov4muiWwgMJb834Cf5o8hYYt6TDvqQdtUKhyVvXhvyzbGw/vRmynNL P790cfOlCrQeJXCMw9AN2qG+o84VF0zrtqZHq0vyDweAzEl48jbxBvCdshgc8iLWzxL0 bPsTqqjRr7f/nuZ/eA3wxedGKCq9VShWIYDD8h7kgq5Wte6O0MPQlmL0+TemsTw63WUj Azw91foqPZP4JrouanKpL5eAJ4QW1j1VZZ0lHeutqVhAcJCmcvAMFyFynzB5xytjlN9I qJeg== X-Gm-Message-State: APjAAAWZeFBu2AgXbbYRs5aRjLim0iZglT8SgyuwckimYOO2bW/GStvH z2T7VmWCsuOUISlZKQ35xQU= X-Google-Smtp-Source: APXvYqzsr0Ao8O6jA7Ftffi4GO93OFuiGOoZfd06FdYMGUzZpoZhqWOAQQrfYgcNFd9W0Q4Ox8VHTw== X-Received: by 2002:a5d:65c5:: with SMTP id e5mr1407766wrw.311.1574236331639; Tue, 19 Nov 2019 23:52:11 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id h15sm32973798wrb.44.2019.11.19.23.52.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Nov 2019 23:52:10 -0800 (PST) Date: Wed, 20 Nov 2019 08:52:09 +0100 From: Michal Hocko To: Andrew Morton Cc: David Hildenbrand , Pavel Tatashin , Vincent Whitchurch , Oscar Salvador , linux-mm@kvack.org, LKML Subject: Re: [PATCH] mm, sparse: do not waste pre allocated memmap space Message-ID: <20191120075209.GB23213@dhcp22.suse.cz> References: <20191119092642.31799-1-mhocko@kernel.org> <20191119141047.a8e31e95b631e28f84dc0bc9@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191119141047.a8e31e95b631e28f84dc0bc9@linux-foundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue 19-11-19 14:10:47, Andrew Morton wrote: > On Tue, 19 Nov 2019 11:03:58 +0100 David Hildenbrand wrote: > > > > @@ -482,8 +481,13 @@ static void __init sparse_buffer_init(unsigned long size, int nid) > > > { > > > phys_addr_t addr = __pa(MAX_DMA_ADDRESS); > > > WARN_ON(sparsemap_buf); /* forgot to call sparse_buffer_fini()? */ > > > + /* > > > + * Pre-allocated buffer is mainly used by __populate_section_memmap > > > + * and we want it to be properly aligned to the section size - this is > > > + * especially the case for VMEMMAP which maps memmap to PMDs > > > + */ > > > sparsemap_buf = > > > - memblock_alloc_try_nid_raw(size, PAGE_SIZE, > > > + memblock_alloc_try_nid_raw(size, section_map_size(), > > > addr, > > > MEMBLOCK_ALLOC_ACCESSIBLE, nid); > > > > Wow, that alignment/layout gives me nightmares ^ > > > > None of your business, though :) > > We're allowed to change it ;) > > --- a/mm/sparse.c~mm-sparse-do-not-waste-pre-allocated-memmap-space-fix > +++ a/mm/sparse.c > @@ -486,10 +486,8 @@ static void __init sparse_buffer_init(un > * and we want it to be properly aligned to the section size - this is > * especially the case for VMEMMAP which maps memmap to PMDs > */ > - sparsemap_buf = > - memblock_alloc_try_nid_raw(size, section_map_size(), > - addr, > - MEMBLOCK_ALLOC_ACCESSIBLE, nid); > + sparsemap_buf = memblock_alloc_try_nid_raw(size, section_map_size(), > + addr, MEMBLOCK_ALLOC_ACCESSIBLE, nid); > sparsemap_buf_end = sparsemap_buf + size; > } I didn't bother mostly because the creative code layout made the intention of the patch more obvious. But if it saves from nightmares then why not. -- Michal Hocko SUSE Labs