The patch titled Subject: mm, pagemap: fix swap offset value for PMD migration entry has been added to the -mm tree. Its filename is mm-pagemap-fix-swap-offset-value-for-pmd-migration-entry.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-pagemap-fix-swap-offset-value-for-pmd-migration-entry.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-pagemap-fix-swap-offset-value-for-pmd-migration-entry.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Huang Ying <ying.huang@xxxxxxxxx> Subject: mm, pagemap: fix swap offset value for PMD migration entry The swap offset reported by /proc/<pid>/pagemap may be not correct for PMD migration entries. If addr passed into pagemap_pmd_range() isn't aligned with PMD start address, the swap offset reported doesn't reflect this. And in the loop to report information of each sub-page, the swap offset isn't increased accordingly as that for PFN. BTW: migration swap entries have PFN information, do we need to restrict whether to show them? Link: http://lkml.kernel.org/r/20180408033737.10897-1-ying.huang@xxxxxxxxx Signed-off-by: "Huang, Ying" <ying.huang@xxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Andrei Vagin <avagin@xxxxxxxxxx> Cc: Dan Williams <dan.j.williams@xxxxxxxxx> Cc: "Jerome Glisse" <jglisse@xxxxxxxxxx> Cc: Daniel Colascione <dancol@xxxxxxxxxx> Cc: Zi Yan <zi.yan@xxxxxxxxxxxxxx> Cc: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- diff -puN fs/proc/task_mmu.c~mm-pagemap-fix-swap-offset-value-for-pmd-migration-entry fs/proc/task_mmu.c --- a/fs/proc/task_mmu.c~mm-pagemap-fix-swap-offset-value-for-pmd-migration-entry +++ a/fs/proc/task_mmu.c @@ -1329,9 +1329,11 @@ static int pagemap_pmd_range(pmd_t *pmdp #ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION else if (is_swap_pmd(pmd)) { swp_entry_t entry = pmd_to_swp_entry(pmd); + unsigned long offset = swp_offset(entry); + offset += (addr & ~PMD_MASK) >> PAGE_SHIFT; frame = swp_type(entry) | - (swp_offset(entry) << MAX_SWAPFILES_SHIFT); + (offset << MAX_SWAPFILES_SHIFT); flags |= PM_SWAP; if (pmd_swp_soft_dirty(pmd)) flags |= PM_SOFT_DIRTY; @@ -1351,6 +1353,8 @@ static int pagemap_pmd_range(pmd_t *pmdp break; if (pm->show_pfn && (flags & PM_PRESENT)) frame++; + else if (flags | PM_SWAP) + frame += (1 << MAX_SWAPFILES_SHIFT); } spin_unlock(ptl); return err; _ Patches currently in -mm which might be from ying.huang@xxxxxxxxx are mm-pagemap-fix-swap-offset-value-for-pmd-migration-entry.patch mm-fix-race-between-swapoff-and-mincore.patch mm-swap-fix-race-between-swapoff-and-some-swap-operations.patch mm-swap-fix-race-between-swapoff-and-some-swap-operations-v6.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html