Re: [BUG] shmem: FALLOC_FL_PUNCH_HOLE vs fault-around race corrupts page cache / rss counters

From: David Hildenbrand (Arm)

Date: Thu Sep 24 2026 - 03:13:20 EST


On 9/24/26 08:16, Ayush Ranjan wrote:
> Hi,
>
> We are seeing shmem/tmpfs page cache corruption on production hosts
> running a workload that punches holes in a memfd (hole-punch based
> memory reclaim) while other threads and forked children fault the
> same MAP_SHARED mapping. The kernel taints but does not oops:
>
> BUG: Bad page cache in process ... pfn:...
> page dumped because: still mapped when deleted
> ...
> dentry name(?): "memfd:..."
>
> and, more frequently, a paired rss-counter imbalance when the mm is
> torn down, always exactly one PMD-order folio (512 pages):
>
> BUG: Bad rss-counter state mm:... type:MM_FILEPAGES val:-512
> BUG: Bad rss-counter state mm:... type:MM_SHMEMPAGES val:512
>
> Seen on 6.12 and 6.18, x86_64, bare metal and VM, with
> /sys/kernel/mm/transparent_hugepage/shmem_enabled = always.
>
> This looks like the same corruption Gregory reported in March, which
> as far as I can tell stalled without a fix; that report needed ~100
> ballooning VMs to reproduce:
>
> https://patchew.org/linux/20260326162611.693539-1-gourry@xxxxxxxxxx/

Indeed, it looks like what was reported in

https://lore.kernel.org/all/20260326162611.693539-1-gourry@xxxxxxxxxx/

--
Cheers,

David