Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp2765643pxx; Sun, 1 Nov 2020 09:10:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJzBqdsmACXclEnE0h+5h4Ymp8NfVdmnQCa6lMo3hzQ52galUcr6rHYhdXDuo6sWkcYg6JW0 X-Received: by 2002:a17:907:2667:: with SMTP id ci7mr6759160ejc.282.1604250642053; Sun, 01 Nov 2020 09:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604250642; cv=none; d=google.com; s=arc-20160816; b=gAUswbxm45/7KzpuMeAWb1zY9cYM2Bn1IQq9ho5HDJLj6Tr9h+giXzL4Gtlv0zmJ3z WdmTJO0btOXOZlPBBm0wa+G7ks+gKkltP1uJMxYczPclmZAMkO1Bd38mz3mu3d+4DpQY zBucgYNl2lVVVBONUBrLpxi9Axc8iAP9Uy3NKlSqPMtqddaPjU+7KyFwwuOBzoWxK7Tl kODCO315Z/wBkGexojdChTsOSyOKjUkQ0BEcpE/diew4HSLGJl/RICYPgCYXKyX+7Hlc /OxhNmsDnerfhxZMX+n8PaM/BDq859elzoieDQYTGe8qZqumJVxM4iN6POwa5lAWRUY7 fbIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0EtOqPSnsYdnCjgov8ewbxO9Ue6uTDAv7hIB5d0jiRg=; b=Ffyo896Y8EBN5iKBOMhjugWYFUZRUcsmyitdSyC8gPTZjCOC3nrSWYphvkyfeCI0U7 93oyQd/Hg3N6ri/jGozOPh0TA08JXbdQnssnlMD3aWvUDAThPRrfMz+cQCsGFeoxJIrD 2SIvg/9CPuYpP3RkqOHGy/CjlUiffuxAcr1DF6+TdyQ0/PexStUcJne3q49ai6PQgKn6 Cas9/bLIyZCgqXdnP2A9SQOu55NMCL4Zpqe4mA33FZGSu6AqmBEjIj+pQFSqyJHX8Qje 9WiWvlSggSdbK5egzFTE41YZYGREw8GpLhhez4rSnAj8Nz6fR1An9IlcXMinbzh5DijO rwJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Vz7hlCOf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r3si3222616eda.352.2020.11.01.09.10.19; Sun, 01 Nov 2020 09:10:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Vz7hlCOf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727298AbgKARG2 (ORCPT + 99 others); Sun, 1 Nov 2020 12:06:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:40668 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727028AbgKARG1 (ORCPT ); Sun, 1 Nov 2020 12:06:27 -0500 Received: from aquarius.haifa.ibm.com (nesher1.haifa.il.ibm.com [195.110.40.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 911202223F; Sun, 1 Nov 2020 17:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604250386; bh=fWxkbZL/5LT7MVmydGQvto+yiZVxeeiLovyNTt2+nMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vz7hlCOfEKvhdYdVx02tccXCR69Tgvys6SCSJ/AwADwwmLCxWzCZRFA3N4DSZ0TNf NMj2sjlY5sUvwwkqZVyNWvWsIKsoWRy4e5mWYOTcjMU9Z7iDHW/BBbA5ZKDtLBao9Y XcPPJPO0UL5x9C2pQixh7DUbitUwk4/sJ48l2D4E= From: Mike Rapoport To: Andrew Morton Cc: Alexey Dobriyan , Catalin Marinas , Geert Uytterhoeven , Greg Ungerer , John Paul Adrian Glaubitz , Jonathan Corbet , Matt Turner , Meelis Roos , Michael Schmitz , Mike Rapoport , Mike Rapoport , Russell King , Tony Luck , Vineet Gupta , Will Deacon , linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mm@kvack.org, linux-snps-arc@lists.infradead.org Subject: [PATCH v2 13/13] m68k: deprecate DISCONTIGMEM Date: Sun, 1 Nov 2020 19:04:54 +0200 Message-Id: <20201101170454.9567-14-rppt@kernel.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201101170454.9567-1-rppt@kernel.org> References: <20201101170454.9567-1-rppt@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Rapoport DISCONTIGMEM was intended to provide more efficient support for systems with holes in their physical address space that FLATMEM did. Yet, it's overhead in terms of the memory consumption seems to overweight the savings on the unused memory map. For a ARAnyM system with 16 MBytes of FastRAM configured, the memory usage reported after page allocator initialization is Memory: 23828K/30720K available (3206K kernel code, 535K rwdata, 936K rodata, 768K init, 193K bss, 6892K reserved, 0K cma-reserved) and with DISCONTIGMEM disabled and with relatively large hole in the memory map it is: Memory: 23864K/30720K available (3197K kernel code, 516K rwdata, 936K rodata, 764K init, 179K bss, 6856K reserved, 0K cma-reserved) Moreover, since m68k already has custom pfn_valid() it is possible to define HAVE_ARCH_PFN_VALID to enable freeing of unused memory map. The minimal size of a hole that can be freed should not be less than MAX_ORDER_NR_PAGES so to achieve more substantial memory savings let m68k also define custom FORCE_MAX_ZONEORDER. With FORCE_MAX_ZONEORDER set to 9 memory usage becomes: Memory: 23880K/30720K available (3197K kernel code, 516K rwdata, 936K rodata, 764K init, 179K bss, 6840K reserved, 0K cma-reserved) Signed-off-by: Mike Rapoport --- arch/m68k/Kconfig.cpu | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu index b8884af365ae..3e70fb7a8d83 100644 --- a/arch/m68k/Kconfig.cpu +++ b/arch/m68k/Kconfig.cpu @@ -20,6 +20,7 @@ choice config M68KCLASSIC bool "Classic M68K CPU family support" + select HAVE_ARCH_PFN_VALID config COLDFIRE bool "Coldfire CPU family support" @@ -377,11 +378,34 @@ config SINGLE_MEMORY_CHUNK help Ignore all but the first contiguous chunk of physical memory for VM purposes. This will save a few bytes kernel size and may speed up - some operations. Say N if not sure. + some operations. + When this option os set to N, you may want to lower "Maximum zone + order" to save memory that could be wasted for unused memory map. + Say N if not sure. config ARCH_DISCONTIGMEM_ENABLE + depends on BROKEN def_bool MMU && !SINGLE_MEMORY_CHUNK +config FORCE_MAX_ZONEORDER + int "Maximum zone order" if ADVANCED + depends on !SINGLE_MEMORY_CHUNK + default "11" + help + The kernel memory allocator divides physically contiguous memory + blocks into "zones", where each zone is a power of two number of + pages. This option selects the largest power of two that the kernel + keeps in the memory allocator. If you need to allocate very large + blocks of physically contiguous memory, then you may need to + increase this value. + + For systems that have holes in their physical address space this + value also defines the minimal size of the hole that allows + freeing unused memory map. + + This config option is actually maximum order plus one. For example, + a value of 11 means that the largest free memory block is 2^10 pages. + config 060_WRITETHROUGH bool "Use write-through caching for 68060 supervisor accesses" depends on ADVANCED && M68060 -- 2.28.0