linux-m68k.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@kernel.org>
To: Michael Schmitz <schmitzmic@gmail.com>
Cc: linux-m68k@lists.linux-m68k.org,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Greg Ungerer <gerg@linux-m68k.org>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Finn Thain <fthain@telegraphics.com.au>,
	John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
	Mike Rapoport <rppt@linux.ibm.com>
Subject: Re: [PATCH v3 0/3] m68k/mm: switch from DISCONTIGMEM to SPARSEMEM
Date: Tue, 25 Aug 2020 08:42:36 +0300	[thread overview]
Message-ID: <20200825054236.GA7303@kernel.org> (raw)
In-Reply-To: <33f4e879-95ea-8302-f0ed-595beb8b98eb@gmail.com>

On Tue, Aug 25, 2020 at 08:47:41AM +1200, Michael Schmitz wrote:
> Hi Mike,
> 
> On 23/08/20 8:06 PM, Mike Rapoport wrote:
> > > > > 20 kB more total memory with sparsemem. Less memory used when booting
> > > > > to FastRAM, more used when booting to ST-RAM (checked right after boot
> > > > > on an idle system). The latter probably isn't significant.
> > > > When booting to FastRAM we still discard ST-RAM and only use it as
> > > > device memory for the framebuffer. So the total memory map size will be
> > > > smaller.
> > > Makes sense, but I was still surprised that replacing discontigmem by
> > > sparsemem saves 20 kB regardless of whether or not ST-RAM is used.
> > The problem with sparse, however, is the memory wasted for empty memmap.
> > For example, if the section size is 16M and there is, say, 17M of
> > FastRAM, the memory map will be created for 32M. This means that there
> > will be 3840 unused 'struct page' objects. :(
> 
> No such thing as a free lunch - that would be a case for the 1G VM limit
> (which I admit, I did not test!)?

For 1G physical memory limit the section size is 4M, so for a system
with 1M of RAM there will be 768 unused 'struct page' objects.
There is an option to free unused memmap, like ARM does [1], or even make
sparsemem to avoid allocating it from the beginning.
This should work, at least for the -mm case, because m68k has
pfn_valid() that does not depend on the memory model.

> In my case, ST-RAM is 14 MB, so only half of the last 4 MB wasted. Note that
> the top of the 16 MB physical area is mapped by early kernel startup as
> noncacheable (hardware registers). I hope this mapping is left alone by
> sparsemem.

Sparsmem will allocate an empty struct page for it, but it should not be
used and even initialized. And I didn't change the page table creation
code, at least not intentionally :)

> Now what would be required to allow use of the ST-RAM chunk (or any other
> memory area mapped out of order) by the kernel memory allocators?

Oh, that's a different story. This will require changes to the way we
create the virtual mapping of the physical memory and to __pa()/__va()
functions.

[1] https://elixir.bootlin.com/linux/latest/source/arch/arm/mm/init.c#L305


-- 
Sincerely yours,
Mike.

      reply	other threads:[~2020-08-25  5:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-18 16:26 [PATCH v3 0/3] m68k/mm: switch from DISCONTIGMEM to SPARSEMEM Mike Rapoport
2020-07-18 16:26 ` [PATCH v3 1/3] m68k/mm: make node data and node setup depend on CONFIG_DISCONTIGMEM Mike Rapoport
2020-07-18 16:26 ` [PATCH v3 2/3] m68k/mm: enable use of generic memory_model.h for !DISCONTIGMEM Mike Rapoport
2020-07-18 16:26 ` [PATCH v3 3/3] m68k/mm: switch from DISCONTIGMEM to SPARSEMEM Mike Rapoport
2020-08-20 16:03 ` [PATCH v3 0/3] " Mike Rapoport
2020-08-20 22:29   ` Michael Schmitz
2020-08-21  7:56     ` Mike Rapoport
2020-08-21 20:58       ` Michael Schmitz
2020-08-21 23:27       ` Michael Schmitz
2020-08-22  9:51         ` Mike Rapoport
2020-08-22 19:16           ` Michael Schmitz
2020-08-23  8:06             ` Mike Rapoport
2020-08-24 20:47               ` Michael Schmitz
2020-08-25  5:42                 ` Mike Rapoport [this message]

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=20200825054236.GA7303@kernel.org \
    --to=rppt@kernel.org \
    --cc=fthain@telegraphics.com.au \
    --cc=geert@linux-m68k.org \
    --cc=gerg@linux-m68k.org \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=rppt@linux.ibm.com \
    --cc=schmitzmic@gmail.com \
    --cc=schwab@linux-m68k.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).