All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@linux.ibm.com>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: Doug Berger <opendmb@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
	sboyd@kernel.org, Kevin Cernekee <cernekee@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Gregory Fong <gregory.0xf0@gmail.com>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: use SPARSMEM_STATIC when SPARSEMEM is enabled (Was: [PATCH 1/2] ARM: Remove redundant ARCH_SPARSEMEM_DEFAULT setting)
Date: Thu, 7 May 2020 23:08:59 +0300	[thread overview]
Message-ID: <20200507200859.GF683243@linux.ibm.com> (raw)
In-Reply-To: <20200507103039.GR1551@shell.armlinux.org.uk>

On Thu, May 07, 2020 at 11:30:39AM +0100, Russell King - ARM Linux admin wrote:
> On Wed, May 06, 2020 at 04:50:08PM -0700, Florian Fainelli wrote:
> > From: Kevin Cernekee <cernekee@gmail.com>
> > 
> > If ARCH_SPARSEMEM_ENABLE=y and ARCH_{FLATMEM,DISCONTIGMEM}_ENABLE=n,
> > then the logic in mm/Kconfig already makes CONFIG_SPARSEMEM the only
> > choice.  This is true for all of the existing ARM users of
> > ARCH_SPARSEMEM_ENABLE.
> > 
> > Forcing ARCH_SPARSEMEM_DEFAULT=y if ARCH_SPARSEMEM_ENABLE=y prevents
> > us from ever defaulting to FLATMEM, so we should remove this setting.
> 
> No explanation why that is desirable.
> 
> > -config ARCH_SPARSEMEM_DEFAULT
> > -	def_bool ARCH_SPARSEMEM_ENABLE
> > -
> 
> What this basically says is ARCH_SPARSEMEM_ENABLE=ARCH_SPARSEMEM_DEFAULT,
> which is exactly what we want for the non-multiplatform boards that
> select ARCH_SPARSEMEM_ENABLE - we _want_ them to default to sparsemem
> because that is what the platform requires.
>
> For example, with RiscPC, which selects ARCH_SPARSEMEM_ENABLE, we have
> four banks of memory at 0x10000000, 0x14000000, 0x18000000 and
> 0x1c000000.  These correspond with the two memory slots - the first two
> for the first slot, and the second two for the second slot.  Each slot
> has two banks.  The size of each memory bank depends on the size of the
> module.

Out of curiosity I've run 

	make ARCH=arm rpc_defconfig
	grep SPARSEMEM .config

and I was surprised to find out that it has

	CONFIG_SPARSEMEM_EXTREME=y

Which would waste several kilibytes of memory for nothing.
Here is the fix:

From 7097c114226b5b1b2fc6bb605bf0d7eae601cc7f Mon Sep 17 00:00:00 2001
From: Mike Rapoport <rppt@linux.ibm.com>
Date: Thu, 7 May 2020 22:39:12 +0300
Subject: [PATCH] arm: use SPARSMEM_STATIC when SPARSEMEM is enabled

The commit 3e347261a80b5 ("[PATCH] sparsemem extreme implementation")
made SPARSMEM_EXTREME the default option for configurations that enable
SPARSEMEM.

For ARM systems with handful of memory banks SPARSEMEM_EXTREME is an
overkill.

Ensure that SPARSMEM_STATIC is enabled in the configurations that use
SPARSEMEM.

Fixes: 3e347261a80b5 ("[PATCH] sparsemem extreme implementation")
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/arm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 66a04f6f4775..c88a48d622fc 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1517,6 +1517,7 @@ config ARCH_HAS_HOLES_MEMORYMODEL
 
 config ARCH_SPARSEMEM_ENABLE
 	bool
+	select SPARSEMEM_STATIC
 
 config ARCH_SPARSEMEM_DEFAULT
 	def_bool ARCH_SPARSEMEM_ENABLE
-- 
2.25.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-05-07 20:09 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06 23:50 [PATCH 0/2] Allow either FLATMEM or SPARSEMEM on the multiplatform build Florian Fainelli
2020-05-06 23:50 ` [PATCH 1/2] ARM: Remove redundant ARCH_SPARSEMEM_DEFAULT setting Florian Fainelli
2020-05-07  7:27   ` Mike Rapoport
2020-05-07 10:30   ` Russell King - ARM Linux admin
2020-05-07 17:25     ` Florian Fainelli
2020-05-07 18:50       ` Russell King - ARM Linux admin
2020-05-07 19:38         ` Florian Fainelli
2020-05-07 20:08     ` Mike Rapoport [this message]
2020-05-08 20:20       ` [PATCH] arm: use SPARSMEM_STATIC when SPARSEMEM is enabled (Was: [PATCH 1/2] ARM: Remove redundant ARCH_SPARSEMEM_DEFAULT setting) Florian Fainelli
2020-05-07 20:29     ` [PATCH 1/2] ARM: Remove redundant ARCH_SPARSEMEM_DEFAULT setting Mike Rapoport
2020-05-07 20:47       ` Florian Fainelli
2020-05-08 21:41         ` Mike Rapoport
2020-05-08 21:45           ` Florian Fainelli
2020-05-06 23:50 ` [PATCH 2/2] ARM: Allow either FLATMEM or SPARSEMEM on the multiplatform build Florian Fainelli
2020-05-07  7:27   ` Mike Rapoport
2020-05-07 20:11     ` Florian Fainelli
2020-05-18 15:58       ` Florian Fainelli
2020-05-18 19:45         ` Mike Rapoport
2020-05-19  7:59           ` Arnd Bergmann
2020-05-19 14:43             ` Mike Rapoport
2020-05-19 15:04               ` Russell King - ARM Linux admin
2020-05-19 15:27                 ` Mike Rapoport
2020-05-19 15:32                   ` Arnd Bergmann
2020-05-19 16:54                     ` Russell King - ARM Linux admin
2020-05-19 17:59                       ` Mike Rapoport
2020-05-19 20:42                       ` Arnd Bergmann
2020-05-21  2:45                         ` Florian Fainelli
2020-05-21  7:47                           ` Arnd Bergmann
2020-05-07  8:14 ` [PATCH 0/2] " Russell King - ARM Linux admin
2020-05-07 10:09   ` Mike Rapoport

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200507200859.GF683243@linux.ibm.com \
    --to=rppt@linux.ibm.com \
    --cc=arnd@arndb.de \
    --cc=cernekee@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregory.0xf0@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=opendmb@gmail.com \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.