From: "Huang, Ying" <ying.huang@linux.alibaba.com>
To: Kairui Song <ryncsn@gmail.com>
Cc: linux-mm@kvack.org, Kairui Song <kasong@tencent.com>,
Andrew Morton <akpm@linux-foundation.org>,
Chris Li <chrisl@kernel.org>, Hugh Dickins <hughd@google.com>,
Yosry Ahmed <yosryahmed@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Johannes Weiner <hannes@cmpxchg.org>,
Barry Song <baohua@kernel.org>, Michal Hocko <mhocko@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/4] mm, memcontrol: avoid duplicated memcg enable check
Date: Sun, 22 Dec 2024 21:33:06 +0800 [thread overview]
Message-ID: <87ed1zj10t.fsf@DESKTOP-5N7EMDA> (raw)
In-Reply-To: <20241218114633.85196-2-ryncsn@gmail.com> (Kairui Song's message of "Wed, 18 Dec 2024 19:46:30 +0800")
Hi, Kairui,
Sorry for jumping in so late.
Kairui Song <ryncsn@gmail.com> writes:
> From: Kairui Song <kasong@tencent.com>
>
> mem_cgroup_uncharge_swap() includes a mem_cgroup_disabled() check,
> so the caller doesn't need to check that.
>
> Signed-off-by: Kairui Song <kasong@tencent.com>
> Reviewed-by: Yosry Ahmed <yosryahmed@google.com>
> Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
> Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
> Acked-by: Chris Li <chrisl@kernel.org>
> ---
> mm/memcontrol.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 7b3503d12aaf..79900a486ed1 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -4609,7 +4609,7 @@ void mem_cgroup_swapin_uncharge_swap(swp_entry_t entry, unsigned int nr_pages)
> * correspond 1:1 to page and swap slot lifetimes: we charge the
> * page to memory here, and uncharge swap when the slot is freed.
> */
> - if (!mem_cgroup_disabled() && do_memsw_account()) {
> + if (do_memsw_account()) {
> /*
> * The swap entry might not get freed for a long time,
> * let's not wait for it. The page already received a
I take a look at memcontrol.c, it appears that almost all extern
functions check mem_cgroup_disabled() as the first step. So I guess
that this is a convention of memcontrol.c? And the benefit of the
change is minimal. In contrast, if someone makes more changes to
mem_cgroup_swapin_uncharge_swap() in the future, he may forget to add
this back. So, it may be unnecessary to make the change?
---
Best Regards,
Huang, Ying
next prev parent reply other threads:[~2024-12-22 13:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-18 11:46 [PATCH v3 0/4] mm/swap_cgroup: remove global swap cgroup lock Kairui Song
2024-12-18 11:46 ` [PATCH v3 1/4] mm, memcontrol: avoid duplicated memcg enable check Kairui Song
2024-12-22 13:33 ` Huang, Ying [this message]
2024-12-22 14:51 ` Kairui Song
2024-12-27 2:03 ` Huang, Ying
2024-12-18 11:46 ` [PATCH v3 2/4] mm/swap_cgroup: remove swap_cgroup_cmpxchg Kairui Song
2024-12-18 11:46 ` [PATCH v3 3/4] mm/swap_cgroup: remove global swap cgroup lock Kairui Song
2024-12-18 11:46 ` [PATCH v3 4/4] mm/swap_cgroup: decouple swap cgroup recording and clearing Kairui Song
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=87ed1zj10t.fsf@DESKTOP-5N7EMDA \
--to=ying.huang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=chrisl@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=roman.gushchin@linux.dev \
--cc=ryncsn@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=yosryahmed@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