The patch titled Subject: mm/swap_state.c: use the same way to count page in [add_to|delete_from]_swap_cache has been added to the -mm tree. Its filename is mm-swap_statec-use-the-same-way-to-count-page-in-_swap_cache.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-swap_statec-use-the-same-way-to-count-page-in-_swap_cache.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-swap_statec-use-the-same-way-to-count-page-in-_swap_cache.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: Wei Yang <richard.weiyang@xxxxxxxxx> Subject: mm/swap_state.c: use the same way to count page in [add_to|delete_from]_swap_cache add_to_swap_cache() and delete_from_swap_cache() are counterparts, while currently they use different ways to count pages. It doesn't break anything because we only have two sizes for PageAnon, but this is confusing and not good practice. This patch corrects it by making both functions use hpage_nr_pages(). Link: http://lkml.kernel.org/r/20200315012920.2687-1-richard.weiyang@xxxxxxxxx Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/swap_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/swap_state.c~mm-swap_statec-use-the-same-way-to-count-page-in-_swap_cache +++ a/mm/swap_state.c @@ -116,7 +116,7 @@ int add_to_swap_cache(struct page *page, struct address_space *address_space = swap_address_space(entry); pgoff_t idx = swp_offset(entry); XA_STATE_ORDER(xas, &address_space->i_pages, idx, compound_order(page)); - unsigned long i, nr = compound_nr(page); + unsigned long i, nr = hpage_nr_pages(page); VM_BUG_ON_PAGE(!PageLocked(page), page); VM_BUG_ON_PAGE(PageSwapCache(page), page); _ Patches currently in -mm which might be from richard.weiyang@xxxxxxxxx are mm-swap_statec-use-the-same-way-to-count-page-in-_swap_cache.patch