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] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 16 Nov 2020 08:33:43 +0000
From:   "Song Bao Hua (Barry Song)" <song.bao.hua@...ilicon.com>
To:     Catalin Marinas <catalin.marinas@....com>,
        Mike Rapoport <rppt@...ux.ibm.com>,
        "liwei (CM)" <liwei213@...wei.com>
CC:     "will@...nel.org" <will@...nel.org>,
        "Xiaqing (A)" <saberlily.xia@...ilicon.com>,
        "Chenfeng (puck)" <puck.chen@...ilicon.com>,
        butao <butao@...ilicon.com>,
        fengbaopeng <fengbaopeng2@...ilicon.com>,
        "nsaenzjulienne@...e.de" <nsaenzjulienne@...e.de>,
        "steve.capper@....com" <steve.capper@....com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        sujunfei <sujunfei2@...ilicon.com>,
        Linuxarm <linuxarm@...wei.com>
Subject: RE: [PATCH v2] arm64: mm: free unused memmap for sparse memory model
 that define VMEMMAP



> -----Original Message-----
> From: Catalin Marinas [mailto:catalin.marinas@....com]
> Sent: Friday, September 4, 2020 12:06 AM
> To: Mike Rapoport <rppt@...ux.ibm.com>
> Cc: liwei (CM) <liwei213@...wei.com>; will@...nel.org; Xiaqing (A)
> <saberlily.xia@...ilicon.com>; Chenfeng (puck) <puck.chen@...ilicon.com>;
> butao <butao@...ilicon.com>; fengbaopeng <fengbaopeng2@...ilicon.com>;
> nsaenzjulienne@...e.de; steve.capper@....com; Song Bao Hua (Barry Song)
> <song.bao.hua@...ilicon.com>; linux-arm-kernel@...ts.infradead.org;
> linux-kernel@...r.kernel.org; sujunfei <sujunfei2@...ilicon.com>
> Subject: Re: [PATCH v2] arm64: mm: free unused memmap for sparse memory
> model that define VMEMMAP
> 
> On Mon, Aug 17, 2020 at 11:04:05AM +0300, Mike Rapoport wrote:
> > On Wed, Aug 12, 2020 at 09:06:55AM +0800, Wei Li wrote:
> > > For the memory hole, sparse memory model that define
> SPARSEMEM_VMEMMAP
> > > do not free the reserved memory for the page map, this patch do it.
> >
> > I've been thinking about it a bit more and it seems that instead of
> > freeing unused memory map it would be better to allocate the exact
> > memory map from the beginning.
> >
> > In sparse_init_nid() we can replace PAGES_PER_SECTION parameter to
> > __populate_section_memmap() with the calculated value for architectures
> > that define HAVE_ARCH_PFN_VALID.
> 
> Or just use a smaller PAGES_PER_SECTION and reduce the waste ;).
> 
> Just to be clear, are you suggesting that we should use pfn_valid() on
> the pages within a section to calculate the actual range? The
> pfn_valid() implementation on arm64 checks for the validity of a sparse
> section, so this would be called from within the sparse_init() code
> path. I hope there's no dependency but I haven't checked. If it works,
> it's fine by me, it solves the FLATMEM mem_map freeing as well.
> 
> With 4KB pages on arm64, vmemmap_populate() stops at the pmd level, so
> it always allocates PMD_SIZE. Wei's patch also only frees in PMD_SIZE
> amounts. So, with a sizeof(struct page) of 64 (2^6), a PMD_SIZE mem_map
> section would cover 2^(21-6) pages, so that's equivalent to a
> SECTION_SIZE_BITS of 21-6+12 = 27.
> 
> If we reduce SECTION_SIZE_BITS to 27 or less, this patch is a no-op.

It would be the simplest way to fix this issue. It seems X86_64 is
also using 27.

@wei, has you ever tried to send a patch to change SECTION_SIZE_BITS
to 27 for ARM64?

> 
> --
> Catalin

Thanks
Barry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ