From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C743DC433E0 for ; Thu, 21 Jan 2021 16:07:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A10723A22 for ; Thu, 21 Jan 2021 16:07:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732019AbhAUQHi (ORCPT ); Thu, 21 Jan 2021 11:07:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:20774 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731795AbhAUQGY (ORCPT ); Thu, 21 Jan 2021 11:06:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611245096; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gJrfazQb48R8qREfS3Tnoev0W+C0yb+jDAvRCgeXo0M=; b=TwCgrwx8FzO9JPM8hr0JYQdRgLdOogtRzD8aR81w8Qd6/aaK8SwkULdrnuDzoJoJflNKW2 Rbxxhuk4Mvf9FU7e5LzgPcmFD51bbqPl0XEAusp2ZlyMG4Sboj7R9ea2a+NhYhaHaKn7UQ tXqVGXrPrs+iU2pi87f6TidfmMGZq/o= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-9PpQOjyVNoS2Od-t-xHorQ-1; Thu, 21 Jan 2021 11:04:51 -0500 X-MC-Unique: 9PpQOjyVNoS2Od-t-xHorQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 12B3010054FF; Thu, 21 Jan 2021 16:04:49 +0000 (UTC) Received: from [10.36.115.70] (ovpn-115-70.ams2.redhat.com [10.36.115.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79F2310074E5; Thu, 21 Jan 2021 16:04:46 +0000 (UTC) Subject: Re: [PATCH 1/1] arm64/sparsemem: reduce SECTION_SIZE_BITS To: Mike Rapoport , Sudarshan Rajagopalan Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Catalin Marinas , Will Deacon , Anshuman Khandual , Mark Rutland , Logan Gunthorpe , Andrew Morton , Steven Price , Suren Baghdasaryan References: <43843c5e092bfe3ec4c41e3c8c78a7ee35b69bb0.1611206601.git.sudaraja@codeaurora.org> <20210121141607.GB7648@linux.ibm.com> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <51c1baf1-9114-4e0e-82f0-c7219e3a0023@redhat.com> Date: Thu, 21 Jan 2021 17:04:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20210121141607.GB7648@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21.01.21 15:16, Mike Rapoport 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 >> Suggested-by: Anshuman Khandual >> Suggested-by: David Hildenbrand >> Cc: Catalin Marinas >> Cc: Will Deacon >> Cc: Anshuman Khandual >> Cc: David Hildenbrand >> Cc: Mike Rapoport >> Cc: Mark Rutland >> Cc: Logan Gunthorpe >> Cc: Andrew Morton >> Cc: Steven Price >> Cc: Suren Baghdasaryan > > Acked-by: Mike Rapoport > > BTW, after reduction of the section size maybe arm64 should consider opting > out of freeing unused memory map. > > This will make David even more happy as this will allow dropping custom > pfn_valid() ;-) Mike knows my wildest dreams ;) -- Thanks, David / dhildenb