Re: [PATCH] mm/shmem: drop the second folio batch from shmem_undo_range()
From: David Hildenbrand (Arm)
Date: Thu Nov 12 2026 - 03:53:08 EST
On 11/12/26 09:05, Baolin Wang wrote:
>
>
> On 11/12/26 11:39 AM, Qiliang Yuan wrote:
>> shmem_undo_range() keeps a folio_batch and an array of FOLIO_BATCH_SIZE
>> indices on its stack. Removing truncated folios from the page cache in
>> batches added a second folio_batch to collect the folios to delete.
>>
>> That grows the stack frame by about 200 bytes, past the 1024 byte limit
>> of mips eyeq6_defconfig built with clang.
>>
>> Pass fbatch itself to delete_from_page_cache_batch() once the swap
>> entries are gone, as truncate_inode_pages_range() does. Undoing a failed
>> fallocate() only removes the folios that are not uptodate, so remove
>> those one at a time with truncate_inode_folio() as before.
>>
>> Stack frame of shmem_undo_range() built with clang 18:
>>
>> config before (bytes) after (bytes) change
>> mips eyeq6_defconfig 928 720 -22%
>> x86_64 920 712 -23%
>>
>> Fixes: b97fbd541ecba ("mm/shmem: remove truncated folios from the page cache
>> in batches")
>> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202611112032.TMyPU6Rm-
>> lkp@xxxxxxxxx/
>> Signed-off-by: Qiliang Yuan <qiliang.yuan@xxxxxxxxx>
>> ---
>> David, this applies on top of b97fbd541ecba in shmem-7.5.misc; please
>> fold it in if you prefer.
>> ---
>
> I think you should send out a complete v2, and David could queue your new version.
Yes please. I'll drop the old patch from core.git. Should be gone later today.
--
Cheers,
David