The patch titled Subject: mm: use swp_offset as key in shmem_replace_page() has been added to the -mm tree. Its filename is mm-use-swp_offset-as-key-in-shmem_replace_page.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-use-swp_offset-as-key-in-shmem_replace_page.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-use-swp_offset-as-key-in-shmem_replace_page.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: Yu Zhao <yuzhao@xxxxxxxxxx> Subject: mm: use swp_offset as key in shmem_replace_page() We changed the key of swap cache tree from swp_entry_t.val to swp_offset. We need to do so in shmem_replace_page() as well. Link: http://lkml.kernel.org/r/20181121215442.138545-1-yuzhao@xxxxxxxxxx Fixes: f6ab1f7f6b2d ("mm, swap: use offset of swap entry as key of swap cache") Signed-off-by: Yu Zhao <yuzhao@xxxxxxxxxx> Reviewed-by: Matthew Wilcox <willy@xxxxxxxxxxxxx> Acked-by: Hugh Dickins <hughd@xxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> [4.9+] Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/mm/shmem.c~mm-use-swp_offset-as-key-in-shmem_replace_page +++ a/mm/shmem.c @@ -1509,11 +1509,13 @@ static int shmem_replace_page(struct pag { struct page *oldpage, *newpage; struct address_space *swap_mapping; + swp_entry_t entry; pgoff_t swap_index; int error; oldpage = *pagep; - swap_index = page_private(oldpage); + entry.val = page_private(oldpage); + swap_index = swp_offset(entry); swap_mapping = page_mapping(oldpage); /* @@ -1532,7 +1534,7 @@ static int shmem_replace_page(struct pag __SetPageLocked(newpage); __SetPageSwapBacked(newpage); SetPageUptodate(newpage); - set_page_private(newpage, swap_index); + set_page_private(newpage, entry.val); SetPageSwapCache(newpage); /* _ Patches currently in -mm which might be from yuzhao@xxxxxxxxxx are mm-use-swp_offset-as-key-in-shmem_replace_page.patch mm-dont-expose-page-to-fast-gup-before-its-ready.patch