cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko-IBi9RG/b67k@public.gmane.org>
To: Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
Cc: hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org,
	vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 4/4] mm: memcontrol: fix swap uncharge on cgroup v2
Date: Mon, 15 Feb 2021 10:47:54 +0100	[thread overview]
Message-ID: <YCpDSnLSDoE/FHK5@dhcp22.suse.cz> (raw)
In-Reply-To: <20210212170159.32153-4-songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>

On Sat 13-02-21 01:01:59, Muchun Song wrote:
> The swap charges the actual number of swap entries on cgroup v2.
> If a swap cache page is charged successful, and then we uncharge
> the swap counter. It is wrong on cgroup v2. Because the swap
> entry is not freed.

Is there any actual problem though? Can you describe the specific
scenario please? Swap cache charge life time is a bit tricky and I have
to confess I have to relearn it every time I need to understand it. The
patch would be much more easier to review if the changelog was much more
specific.

> Fixes: 2d1c498072de ("mm: memcontrol: make swap tracking an integral part of memory control")
> Signed-off-by: Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
> ---
>  mm/memcontrol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index c737c8f05992..be6bc5044150 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -6753,7 +6753,7 @@ int mem_cgroup_charge(struct page *page, struct mm_struct *mm, gfp_t gfp_mask)
>  	memcg_check_events(memcg, page);
>  	local_irq_enable();
>  
> -	if (PageSwapCache(page)) {
> +	if (!cgroup_subsys_on_dfl(memory_cgrp_subsys) && PageSwapCache(page)) {
>  		swp_entry_t entry = { .val = page_private(page) };
>  		/*
>  		 * The swap entry might not get freed for a long time,
> -- 
> 2.11.0

-- 
Michal Hocko
SUSE Labs

  parent reply	other threads:[~2021-02-15  9:47 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12 17:01 [PATCH 1/4] mm: memcontrol: remove memcg check from memcg_oom_recover Muchun Song
     [not found] ` <20210212170159.32153-1-songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
2021-02-12 17:01   ` [PATCH 2/4] mm: memcontrol: add missing memcg_oom_recover() when uncharge slab page Muchun Song
     [not found]     ` <20210212170159.32153-2-songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
2021-02-15  9:37       ` Michal Hocko
2021-02-12 17:01   ` [PATCH 3/4] mm: memcontrol: bail out early when id is zero Muchun Song
     [not found]     ` <20210212170159.32153-3-songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
2021-02-15  9:39       ` Michal Hocko
     [not found]         ` <YCpBUm2N4Bqm5PM5-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2021-02-15 10:09           ` [External] " Muchun Song
     [not found]             ` <CAMZfGtVkh-DeYLLo8Nn7kHMCq055RSvL03eON1iqmhydYiQ-iQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-02-15 10:27               ` Michal Hocko
     [not found]                 ` <YCpMo6gLFyqANsgd-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2021-02-15 11:34                   ` Muchun Song
2021-02-12 17:01   ` [PATCH 4/4] mm: memcontrol: fix swap uncharge on cgroup v2 Muchun Song
2021-02-12 18:56     ` Shakeel Butt
2021-02-13  6:48       ` [External] " Muchun Song
     [not found]         ` <CAMZfGtUpsbiVW7AtBtfYjFvppv+7MmAcff_x872gbeMuv8zs3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-02-16 17:16           ` Shakeel Butt
     [not found]     ` <20210212170159.32153-4-songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
2021-02-15  9:47       ` Michal Hocko [this message]
     [not found]         ` <YCpDSnLSDoE/FHK5-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2021-02-15 10:15           ` Muchun Song
     [not found]             ` <CAMZfGtVSXG5BRR9R3_+eeoCCWBW87GLVNLPwZCyDUHNeAPrXUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-02-15 10:24               ` Michal Hocko
2021-02-16 16:59     ` Johannes Weiner
     [not found]       ` <YCv51LgGIWxVjLHT-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2021-02-16 17:17         ` Shakeel Butt
2021-02-16 17:19         ` Michal Hocko
2021-02-16 17:28         ` Johannes Weiner
     [not found]           ` <YCwApSWpgOTOZEMx-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2021-02-17  5:15             ` [External] " Muchun Song
2021-02-17  5:11         ` Muchun Song
2021-02-15  9:24   ` [PATCH 1/4] mm: memcontrol: remove memcg check from memcg_oom_recover Michal Hocko

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=YCpDSnLSDoE/FHK5@dhcp22.suse.cz \
    --to=mhocko-ibi9rg/b67k@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
    --cc=vdavydov.dev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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).