The patch titled Subject: memcg: set page->private before calling swap_readpage has been added to the -mm tree. Its filename is memcg-charge-before-adding-to-swapcache-on-swapin-fix.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/memcg-charge-before-adding-to-swapcache-on-swapin-fix.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/memcg-charge-before-adding-to-swapcache-on-swapin-fix.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: Shakeel Butt <shakeelb@xxxxxxxxxx> Subject: memcg: set page->private before calling swap_readpage The function swap_readpage() (and other functions it call) extracts swap entry from page->private. However for SWP_SYNCHRONOUS_IO, the kernel skips the swapcache and thus we need to manually set the page->private with the swap entry before calling swap_readpage(). Link: https://lkml.kernel.org/r/20210318015959.2986837-1-shakeelb@xxxxxxxxxx Signed-off-by: Shakeel Butt <shakeelb@xxxxxxxxxx> Reported-by: Heiko Carstens <hca@xxxxxxxxxxxxx> Cc: Roman Gushchin <guro@xxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> Cc: Christian Borntraeger <borntraeger@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/mm/memory.c~memcg-charge-before-adding-to-swapcache-on-swapin-fix +++ a/mm/memory.c @@ -3324,7 +3324,11 @@ vm_fault_t do_swap_page(struct vm_fault workingset_refault(page, shadow); lru_cache_add(page); + + /* To provide entry to swap_readpage() */ + set_page_private(page, entry.val); swap_readpage(page, true); + set_page_private(page, 0); } } else { page = swapin_readahead(entry, GFP_HIGHUSER_MOVABLE, _ Patches currently in -mm which might be from shakeelb@xxxxxxxxxx are memcg-cleanup-root-memcg-checks.patch memcg-enable-memcg-oom-kill-for-__gfp_nofail.patch memcg-charge-before-adding-to-swapcache-on-swapin.patch memcg-charge-before-adding-to-swapcache-on-swapin-fix.patch