[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251003150956.2870745-1-kartikey406@gmail.com>
Date: Fri, 3 Oct 2025 20:39:56 +0530
From: Deepanshu Kartikey <kartikey406@...il.com>
To: akpm@...ux-foundation.org,
broonie@...nel.org
Cc: muchun.song@...ux.dev,
osalvador@...e.de,
david@...hat.com,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
syzbot+f26d7c75c26ec19790e7@...kaller.appspotmail.com,
Aishwarya.TCV@....com
Subject: Re: [PATCH v2] hugetlbfs: skip VMAs without shareable locks in hugetlb_vmdelete_list
Hi,
My previous patch dd83609b8898 ("hugetlbfs: skip VMAs without shareable
locks in hugetlb_vmdelete_list") fixed a WARNING but introduced a
regression where pages aren't freed during punch hole operations, as
reported by Mark Brown.
The issue is that skipping the entire VMA means pages don't get unmapped,
so they can't be freed.
I'm considering the following fix approach:
1. Add a new ZAP_FLAG_NO_UNSHARE flag
2. In hugetlb_vmdelete_list(), try to get the shareable lock
3. If we can't get it, set ZAP_FLAG_NO_UNSHARE and proceed anyway
4. In __unmap_hugepage_range(), skip huge_pmd_unshare() if flag is set
5. But still clear page table entries so pages get freed
This way:
- For truncate: same behavior as before (might skip unsharing)
- For punch hole: pages get freed immediately (fixes regression)
- No WARNING (we don't call huge_pmd_unshare without lock)
The trade-off is that PMD metadata may not be cleaned up immediately
when we can't get the shareable lock, but it will be freed when the
VMA is destroyed.
Does this approach seem reasonable? Or is there a better way to handle
this?
Thanks,
Deepanshu
Powered by blists - more mailing lists