lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 20 Nov 2019 08:52:09 +0100
From:   Michal Hocko <mhocko@...nel.org>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     David Hildenbrand <david@...hat.com>,
        Pavel Tatashin <pasha.tatashin@...een.com>,
        Vincent Whitchurch <vincent.whitchurch@...s.com>,
        Oscar Salvador <OSalvador@...e.com>, linux-mm@...ck.org,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm, sparse: do not waste pre allocated memmap space

On Tue 19-11-19 14:10:47, Andrew Morton wrote:
> On Tue, 19 Nov 2019 11:03:58 +0100 David Hildenbrand <david@...hat.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ