]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: shmem: fix too little space for tmpfs only fallback 4KB
authorVernon Yang <yanglincheng@kylinos.cn>
Mon, 8 Sep 2025 12:31:28 +0000 (20:31 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 12 Sep 2025 00:26:00 +0000 (17:26 -0700)
commit04a6e5fdcdf489437d7f553d8dcec3cf497b0d94
tree32c2a19e2290cdd48b33be43886a904cf02adff4
parent70a2186caf8677d7a8bca5ca6b67c704e8310661
mm: shmem: fix too little space for tmpfs only fallback 4KB

When the system memory is sufficient, allocating memory is always
successful, but when tmpfs size is low (e.g.  1MB), it falls back directly
from 2MB to 4KB, and other small granularity (8KB ~ 1024KB) will not be
tried.

Therefore add check whether the remaining space of tmpfs is sufficient for
allocation.  If there is too little space left, try smaller large folio.

Link: https://lkml.kernel.org/r/20250908123128.900254-1-vernon2gm@gmail.com
Fixes: acd7ccb284b8 ("mm: shmem: add large folio support for tmpfs")
Signed-off-by: Vernon Yang <yanglincheng@kylinos.cn>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Daniel Gomez <da.gomez@samsung.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/shmem.c