From: Michal Hocko <mhocko@suse.com>
To: Shakeel Butt <shakeelb@google.com>
Cc: Hugh Dickins <hughd@google.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Roman Gushchin <guro@fb.com>,
Andrew Morton <akpm@linux-foundation.org>,
Minchan Kim <minchan@kernel.org>,
cgroups@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>
Subject: Re: [PATCH] memcg: set page->private before calling swap_readpage
Date: Thu, 18 Mar 2021 15:01:25 +0100 [thread overview]
Message-ID: <YFNdNeczjnmF55bm@dhcp22.suse.cz> (raw)
In-Reply-To: <20210318015959.2986837-1-shakeelb@google.com>
On Wed 17-03-21 18:59:59, Shakeel Butt wrote:
> 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().
One thing that is not really clear to me is whether/why this is only
needed with your patch. Can you expand a bit on that please? Maybe I am
just missing something obvious but I just do not see any connection.
> Signed-off-by: Shakeel Butt <shakeelb@google.com>
> Reported-by: Heiko Carstens <hca@linux.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
>
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2021-03-18 14:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 1:59 [PATCH] memcg: set page->private before calling swap_readpage Shakeel Butt
2021-03-18 8:55 ` Heiko Carstens
2021-03-18 14:01 ` Michal Hocko [this message]
2021-03-18 15:02 ` Johannes Weiner
2021-03-18 15:08 ` Michal Hocko
2021-03-18 15:03 ` Johannes Weiner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YFNdNeczjnmF55bm@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=hca@linux.ibm.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=minchan@kernel.org \
--cc=shakeelb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).