From: Greg Ungerer <gerg@linux-m68k.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: linux-m68k@lists.linux-m68k.org, linux-mm@kvack.org
Subject: Re: nommu and folios
Date: Tue, 15 Jul 2025 23:54:21 +1000 [thread overview]
Message-ID: <f2582a94-1bbc-41a0-9a21-17e77f3979a3@linux-m68k.org> (raw)
In-Reply-To: <aHVY3PIBI0M7Whi7@casper.infradead.org>
Hi Matthew,
On 15/7/25 05:22, Matthew Wilcox wrote:
> Hi Greg!
>
> The last user of add_to_page_cache_lru() is fs/ramfs/file-nommu.c I
> think I need your advice about how best to proceed with nommu and folios.
>
> The basic idea behind folios is that they represent a physically,
> logically and virtually contiguous block of memory that is a power-of-2
> bytes in size >= PAGE_SIZE. struct page is going to be shrunk and it'll
> be most efficient if we can arrange for allocations to be larger in size.
>
> UCLinux obviously has very different performance requirements from the
> kinds of systems I usually work on -- memory usage minimisation is much
> more important. So ideally we wouldn't split the allocation all the way
> to order-0 in ramfs_nommu_expand_for_mapping(), but do a split at just
> the break point. eg if we have a 40kB file, we'd allocate an order-4
> folio, split it into an order-3 folio and add that to the page cache;
> split the order-2 page from the end and free it; split the remainder
> into one order-1 folio, add it to the page cache and free the remaining
> order-1 page.
>
> The problem here is that all the code for handling large folios is
> currently gated by CONFIG_TRANSPARENT_HUGEPAGE, which I'm guessing is
> not enabled by any uclinux configs ;-)
Yeah, pretty sure that is right :-)
Interestingly there is one architecture that is by default 64bit, RISCV.
It has good support for running nommu. Though I don't think in practice
that you would see nommu systems using it with largish memory sizes.
Even then I doubt they would be using TRANSPARENT HUPGEPAGES either.
> Something I've been wanting to do for a while is split out the code
> for handling PMD-sized folios from the code for splitting large folios
> into smaller folios. That's necessarily going to increase the size of
> the text section for uclinux, but hopefully it'll be worthwhile because
> it'll decrease how much memory is allocated at runtime.
That sounds like a win overall. Anyone using modern kernels on nommu
has to accept the ever increasing kernel text section anyway.
> Of course if uclinux files are typically PAGE_SIZE or smaller, this isn't
> going to help at all.
Average file size is probably larger than PAGE_SIZE. All the standard
application binaries will be much larger.
> Which brings me to the really sticky question
> ... how much do you care about uclinux support in a 2025 and later kernel?
> I have no idea how actively microcontroller people use Linux or update
> to recent kernels. I'm not trying to push uclinux out, just don't want
> to do work that nobody will ever use ;-)
That is really hard to answer. My gut feeling is that it may not be used
that much any more. But then I keep getting surprised when people show up
with new silicon that has no MMU (RISCV being a case in point). From what
I can tell it is still popular with the ARM/Cortex-M variants as well.
Not really sure about the Xtensa community, they may be active too.
Regards
Greg
prev parent reply other threads:[~2025-07-15 13:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-14 19:22 Matthew Wilcox
2025-07-15 13:54 ` Greg Ungerer [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=f2582a94-1bbc-41a0-9a21-17e77f3979a3@linux-m68k.org \
--to=gerg@linux-m68k.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.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