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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 E950FC43215 for ; Tue, 19 Nov 2019 22:10:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A85892245B for ; Tue, 19 Nov 2019 22:10:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="Ox4RnNzq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A85892245B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3B5C66B0005; Tue, 19 Nov 2019 17:10:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 33FA16B0006; Tue, 19 Nov 2019 17:10:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 22E616B0007; Tue, 19 Nov 2019 17:10:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0210.hostedemail.com [216.40.44.210]) by kanga.kvack.org (Postfix) with ESMTP id 093E26B0005 for ; Tue, 19 Nov 2019 17:10:50 -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 C7756180AD80F for ; Tue, 19 Nov 2019 22:10:49 +0000 (UTC) X-FDA: 76174422618.19.roof01_41695deaab73d X-HE-Tag: roof01_41695deaab73d X-Filterd-Recvd-Size: 3212 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Tue, 19 Nov 2019 22:10:49 +0000 (UTC) Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 104F722445; Tue, 19 Nov 2019 22:10:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574201448; bh=l79WBsC8E5Lcg7exxmqTQyn1rU0Uq4SRrjSuf8Ymrfo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Ox4RnNzqGdy5pbnYZy5+y/vuNQAT15V/Rs86upWAjc7FPjFFrZilAxG2mB555LJKI EdPAd8f2idHmjHtzFtS6I8fH2kKhep+cTQukXM5qrMYfBwF4rg9ANG06aFPMCFeHr3 dZAogaLYxSID7JEAGJf1rjdxk/FVOjYjgroimnYw= Date: Tue, 19 Nov 2019 14:10:47 -0800 From: Andrew Morton To: David Hildenbrand Cc: Michal Hocko , Pavel Tatashin , Vincent Whitchurch , Oscar Salvador , linux-mm@kvack.org, LKML , Michal Hocko Subject: Re: [PATCH] mm, sparse: do not waste pre allocated memmap space Message-Id: <20191119141047.a8e31e95b631e28f84dc0bc9@linux-foundation.org> In-Reply-To: References: <20191119092642.31799-1-mhocko@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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; } _