The goal of this small series is to replace the previous patch (which is the 5th patch of the series): https://lore.kernel.org/linux-mm/20210908163628.215052-1-peterx@xxxxxxxxxx/ This patch used a more aggresive (but IMHO cleaner and correct..) approach by removing that trick to skip swap entries, then we handle swap entries always. The behavior of "skipping swap entries" existed starting from the initial git commit that we'll try to skip swap entries when zapping ptes if zap_detail pointer specified. I found that it's probably broken because of the introduction of page migration mechanism that does not exist yet in the world of 1st git commit, then we could errornously skip scanning the swap entries for file-backed memory, like shmem, while we should. I'm afraid we'll have RSS accounting wrong for those shmem pages during migration so there could have leftover SHMEM RSS accounts. Patch 1 did that removal of the trick, details in the commit message. Patch 2 is a further cleanup for zap pte swap handling that can be done after patch 1, in which there's no functional change intended. The change should be on the slow path for zapping swap entries (e.g., we handle none/present ptes in early code path always, so they're totally not affected), but if anyone worries about specific workload that may be affected by this patchset, please let me know and I'll be happy to run some more tests. I could also overlook something that was buried in history, in that case please kindly point that out. Marking the patchset RFC for this. Smoke tested only. Please review, thanks. Peter Xu (2): mm: Don't skip swap entry even if zap_details specified mm: Rework swap handling of zap_pte_range mm/memory.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) -- 2.32.0