From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756964AbbIVLRc (ORCPT ); Tue, 22 Sep 2015 07:17:32 -0400 Received: from eu-smtp-delivery-143.mimecast.com ([146.101.78.143]:45997 "EHLO eu-smtp-delivery-143.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751481AbbIVLRa convert rfc822-to-8bit (ORCPT ); Tue, 22 Sep 2015 07:17:30 -0400 Date: Tue, 22 Sep 2015 12:17:27 +0100 From: Dave Martin To: chenfeng Cc: catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, ard.biesheuvel@linaro.org, lauraa@codeaurora.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dan zhao , Yiping Xu , suzhuangluan@hisilicon.com, qijiwen , oliver.fu@hisilicon.com, Peter Panshilin Subject: Re: Question about the sparse memory section size Message-ID: <20150922111723.GI6281@e103592.cambridge.arm.com> References: <56010DDD.3080803@hisilicon.com> MIME-Version: 1.0 In-Reply-To: <56010DDD.3080803@hisilicon.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-OriginalArrivalTime: 22 Sep 2015 11:17:27.0279 (UTC) FILETIME=[43720FF0:01D0F528] X-MC-Unique: NZzFniCuSy6crudTds03Xg-1 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 22, 2015 at 04:14:21PM +0800, chenfeng wrote: > Hi all, > The sparse memory section size, SECTION_SIZE_BITS, currently is 1GB > for arm64 by default. However, it might generate wasted memmap memory > space for those memory sections less than 1GB. e.g. > > for 512MB memory section, still 14MB(sizeof(struct page) * > PAGES_PER_SECTION) memmap needs to be reserved. The wasted memmap > space could be eliminated by changing memory section size from 1GB to > 512M, but still some questions to be answered, > > 1) why arm64 uses 1GB as default setting? > 2) any risk to change section size from 1GB to 512MB? like, any > impact to performance since memory section number is increased. For arm64 we have SPARSEMEM_VMEMMAP enabled by default, which enables much of the wasted memmap backing memory to be reclaimed. Take a look at arch/arm64/mm/init.c:free_unused_memmap(). This should reduce the amount of actual memory wasted on unused parts of memmap. The virtual space stays wasted as you describe, but that's plentiful on 64-bit arches. You could try sticking some printks in there is you want to see how much of the memmap the code successfully frees. Cheers ---Dave