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:   Fri, 22 Jan 2021 08:28:03 +0530
From:   Anshuman Khandual <anshuman.khandual@....com>
To:     Will Deacon <will@...nel.org>,
        Sudarshan Rajagopalan <sudaraja@...eaurora.org>
Cc:     linux-mm@...ck.org, linux-arm-kernel@...ts.infradead.org,
        linux-kernel@...r.kernel.org,
        Catalin Marinas <catalin.marinas@....com>,
        David Hildenbrand <david@...hat.com>,
        Mike Rapoport <rppt@...ux.ibm.com>,
        Mark Rutland <mark.rutland@....com>,
        Logan Gunthorpe <logang@...tatee.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Steven Price <steven.price@....com>,
        Suren Baghdasaryan <surenb@...gle.com>
Subject: Re: [PATCH 1/1] arm64/sparsemem: reduce SECTION_SIZE_BITS



On 1/21/21 7:06 PM, Will Deacon wrote:
> On Wed, Jan 20, 2021 at 09:29:13PM -0800, Sudarshan Rajagopalan wrote:
>> memory_block_size_bytes() determines the memory hotplug granularity i.e the
>> amount of memory which can be hot added or hot removed from the kernel. The
>> generic value here being MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS)
>> for memory_block_size_bytes() on platforms like arm64 that does not override.
>>
>> Current SECTION_SIZE_BITS is 30 i.e 1GB which is large and a reduction here
>> increases memory hotplug granularity, thus improving its agility. A reduced
>> section size also reduces memory wastage in vmemmmap mapping for sections
>> with large memory holes. So we try to set the least section size as possible.
>>
>> A section size bits selection must follow:
>> (MAX_ORDER - 1 + PAGE_SHIFT) <= SECTION_SIZE_BITS
>>
>> CONFIG_FORCE_MAX_ZONEORDER is always defined on arm64 and so just following it
>> would help achieve the smallest section size.
>>
>> SECTION_SIZE_BITS = (CONFIG_FORCE_MAX_ZONEORDER - 1 + PAGE_SHIFT)
>>
>> SECTION_SIZE_BITS = 22 (11 - 1 + 12) i.e 4MB   for 4K pages
>> SECTION_SIZE_BITS = 24 (11 - 1 + 14) i.e 16MB  for 16K pages without THP
>> SECTION_SIZE_BITS = 25 (12 - 1 + 14) i.e 32MB  for 16K pages with THP
>> SECTION_SIZE_BITS = 26 (11 - 1 + 16) i.e 64MB  for 64K pages without THP
>> SECTION_SIZE_BITS = 29 (14 - 1 + 16) i.e 512MB for 64K pages with THP
>>
>> But there are other problems in reducing SECTION_SIZE_BIT. Reducing it by too
>> much would over populate /sys/devices/system/memory/ and also consume too many
>> page->flags bits in the !vmemmap case. Also section size needs to be multiple
>> of 128MB to have PMD based vmemmap mapping with CONFIG_ARM64_4K_PAGES.
>>
>> Given these constraints, lets just reduce the section size to 128MB for 4K
>> and 16K base page size configs, and to 512MB for 64K base page size config.
>>
>> Signed-off-by: Sudarshan Rajagopalan <sudaraja@...eaurora.org>
>> Suggested-by: Anshuman Khandual <anshuman.khandual@....com>
>> Suggested-by: David Hildenbrand <david@...hat.com>
>> Cc: Catalin Marinas <catalin.marinas@....com>
>> Cc: Will Deacon <will@...nel.org>
>> Cc: Anshuman Khandual <anshuman.khandual@....com>
>> Cc: David Hildenbrand <david@...hat.com>
>> Cc: Mike Rapoport <rppt@...ux.ibm.com>
>> Cc: Mark Rutland <mark.rutland@....com>
>> Cc: Logan Gunthorpe <logang@...tatee.com>
>> Cc: Andrew Morton <akpm@...ux-foundation.org>
>> Cc: Steven Price <steven.price@....com>
>> Cc: Suren Baghdasaryan <surenb@...gle.com>
>> ---
>>  arch/arm64/include/asm/sparsemem.h | 23 +++++++++++++++++++++--
>>  1 file changed, 21 insertions(+), 2 deletions(-)
> 
> Anshuman -- are you happy with this now?

Yes.

A small nit. There are couple of extra lines in the patch which
can be dropped, probably while merging.

Reviewed-by: Anshuman Khandual <anshuman.khandual@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ