From: Michal Hocko <mhocko@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: David Hildenbrand <david@redhat.com>,
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>
Subject: Re: [PATCH] mm, sparse: do not waste pre allocated memmap space
Date: Wed, 20 Nov 2019 08:52:09 +0100 [thread overview]
Message-ID: <20191120075209.GB23213@dhcp22.suse.cz> (raw)
In-Reply-To: <20191119141047.a8e31e95b631e28f84dc0bc9@linux-foundation.org>
On Tue 19-11-19 14:10:47, Andrew Morton wrote:
> 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;
> }
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
prev parent reply other threads:[~2019-11-20 7:52 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
2019-11-20 7:52 ` Michal Hocko [this message]
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=20191120075209.GB23213@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=OSalvador@suse.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--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