On 16/06/2024 11:23, Barry Song wrote: > On Sun, Jun 16, 2024 at 4:54 PM Christoph Hellwig <hch@xxxxxx> wrote: >> >> On Sun, Jun 16, 2024 at 12:16:10PM +1200, Barry Song wrote: >>> As I understand it, this isn't happening because we don't support >>> mTHP swapping out to a swapfile, whether it's on NFS or any >>> other filesystem. >> >> It does happen. The reason why I sent this patch is becaue I observed >> the BUG_ON trigger on a trivial swap generation workload (usemem.c from >> xfstests). > > This is quite unusual. Could you share your setup and backtrace? I'd > like to reproduce the issue, as the mm code only supports mTHP > swapout on block devices. What is your swap device or swap file? > Additionally, on what kind of filesystem is the executable file built > from usemem.c located? Yes, I'm also confused by this, since as Barry says, the swap-out changes to support mTHP are only intended to be activated when the swap device is a non-rotating block device - swap files on file systems are explicitly not supported and all swapping should be done page-by-page in that case. This constraint is exactly the same as for the pre-existing PMD-size THP swap-out support. So if you are seeing large folios being written after the mTHP swap-out change, you should also be seeing large folios before this change. Hopefully the stack trace will tell us what's going on here. (Sorry for my slow responses/lack of engagement over the last month; its been a combination of paternity leave/lack of sleep/working on other things. I'm hoping to get properly back into this stuff within the next couple of weeks). Thanks, Ryan