linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: David Hildenbrand <david@redhat.com>
Cc: Michal Hocko <mhocko@kernel.org>,
	Pavel Tatashin <pasha.tatashin@soleen.com>,
	Vincent Whitchurch <vincent.whitchurch@axis.com>,
	Oscar Salvador <OSalvador@suse.com>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@suse.com>
Subject: Re: [PATCH] mm, sparse: do not waste pre allocated memmap space
Date: Tue, 19 Nov 2019 14:10:47 -0800	[thread overview]
Message-ID: <20191119141047.a8e31e95b631e28f84dc0bc9@linux-foundation.org> (raw)
In-Reply-To: <def84c96-a7d0-1026-a890-a8eca2e6a458@redhat.com>

On Tue, 19 Nov 2019 11:03:58 +0100 David Hildenbrand <david@redhat.com> 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;
 }
 
_



  reply	other threads:[~2019-11-19 22:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19  9:26 Michal Hocko
2019-11-19 10:03 ` David Hildenbrand
2019-11-19 22:10   ` Andrew Morton [this message]
2019-11-20  7:52     ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191119141047.a8e31e95b631e28f84dc0bc9@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=OSalvador@suse.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=vincent.whitchurch@axis.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox