Re: [PATCH v3] mm: readahead: make thp readahead conditional to mmap_miss logic

From: Andrew Morton

Date: Tue Oct 07 2025 - 18:34:24 EST


On Mon, 6 Oct 2025 10:51:06 -0700 Roman Gushchin <roman.gushchin@xxxxxxxxx> wrote:

> Commit 4687fdbb805a ("mm/filemap: Support VM_HUGEPAGE for file mappings")
> introduced a special handling for VM_HUGEPAGE mappings: even if the
> readahead is disabled, 1 or 2 HPAGE_PMD_ORDER pages are
> allocated.

Three years ago.

> This change causes a significant regression

So no backport suggested? I guess reasonable given how long 4687fdbb805a has
been in tree.

>
> ...
>

> for containers with a
> tight memory.max limit, if VM_HUGEPAGE is widely used. Prior to this
> commit, mmap_miss logic would eventually lead to the readahead
> disablement, effectively reducing the memory pressure in the
> cgroup. With this change the kernel is trying to allocate 1-2 huge
> pages for each fault, no matter if these pages are used or not
> before being evicted, increasing the memory pressure multi-fold.
>
> ...
>
> Signed-off-by: Roman Gushchin <roman.gushchin@xxxxxxxxx>
> Cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> Cc: Jan Kara <jack@xxxxxxx>
> Cc: Dev Jain <dev.jain@xxxxxxx>

But I'll slap the Fixes: in there, it might help someone.