Re: cgroup and FALLOC_FL_PUNCH_HOLE: WARNING: CPU: 13 PID: 2438 at mm/page_counter.c:57 page_counter_uncharge+0x4b/0x5

From: David Hildenbrand
Date: Wed Oct 14 2020 - 12:15:30 EST


On 14.10.20 17:22, David Hildenbrand wrote:
> Hi everybody,
>
> Michal Privoznik played with "free page reporting" in QEMU/virtio-balloon
> with hugetlbfs and reported that this results in [1]
>
> 1. WARNING: CPU: 13 PID: 2438 at mm/page_counter.c:57 page_counter_uncharge+0x4b/0x5
>
> 2. Any hugetlbfs allocations failing. (I assume because some accounting is wrong)
>
>
> QEMU with free page hinting uses fallocate(FALLOC_FL_PUNCH_HOLE)
> to discard pages that are reported as free by a VM. The reporting
> granularity is in pageblock granularity. So when the guest reports
> 2M chunks, we fallocate(FALLOC_FL_PUNCH_HOLE) one huge page in QEMU.
>
> I was also able to reproduce (also with virtio-mem, which similarly
> uses fallocate(FALLOC_FL_PUNCH_HOLE)) on latest v5.9
> (and on v5.7.X from F32).
>
> Looks like something with fallocate(FALLOC_FL_PUNCH_HOLE) accounting
> is broken with cgroups. I did *not* try without cgroups yet.
>
> Any ideas?

Just tried without the hugetlb controller, seems to work just fine.

I'd like to note that
- The controller was not activated
- I had to compile the hugetlb controller out to make it work.

--
Thanks,

David / dhildenb