[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210318015959.2986837-1-shakeelb@google.com>
Date: Wed, 17 Mar 2021 18:59:59 -0700
From: Shakeel Butt <shakeelb@...gle.com>
To: Hugh Dickins <hughd@...gle.com>,
Johannes Weiner <hannes@...xchg.org>
Cc: Roman Gushchin <guro@...com>, Michal Hocko <mhocko@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Minchan Kim <minchan@...nel.org>, cgroups@...r.kernel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Shakeel Butt <shakeelb@...gle.com>,
Heiko Carstens <hca@...ux.ibm.com>
Subject: [PATCH] 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().
Signed-off-by: Shakeel Butt <shakeelb@...gle.com>
Reported-by: Heiko Carstens <hca@...ux.ibm.com>
---
Andrew, please squash this into "memcg: charge before adding to
swapcache on swapin" patch.
mm/memory.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/memory.c b/mm/memory.c
index aefd158ae1ea..b6f3410b5902 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3324,7 +3324,11 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
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,
--
2.31.0.rc2.261.g7f71774620-goog
Powered by blists - more mailing lists