Re: [PATCH v2 3/4] mm/shmem, swap: improve mthp swapin process

From: Baolin Wang
Date: Sun Jun 22 2025 - 23:37:39 EST


Hi Kairui,

On 2025/6/20 01:55, Kairui Song wrote:
From: Kairui Song <kasong@xxxxxxxxxxx>

Tidy up the mTHP swapin code, reduce duplicated codes and slightly
tweak the workflow.

For SWP_SYNCHRONOUS_IO devices, we should skip the readahead and swap
cache even if the swapin falls back to order 0. Readahead is not helpful
for such devices.

Yes, agree.

Also consolidates the mTHP related check to one place so they are now
all wrapped by CONFIG_TRANSPARENT_HUGEPAGE, and will be trimmed off by
compiler if not needed.

I like your idea. But I found this patch hard to review, since you you mixed too many changes into one patch. I think you could at least split it into 3 patches to make it easier for the reviewer to review and test:

1. consolidate the mTHP related check to one place (cleanup)
2. tidy up the mTHP swapin code (cleanup)
3. skip swapcache for order 0