lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMgjq7Aeh9LCtSkG_RMrZjO_tvGryYA-QuvU9k1ahOzEv8LkgQ@mail.gmail.com>
Date: Tue, 3 Dec 2024 16:25:57 +0800
From: Kairui Song <ryncsn@...il.com>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>, 
	Chris Li <chrisl@...nel.org>, Hugh Dickins <hughd@...gle.com>, 
	"Huang, Ying" <ying.huang@...el.com>, Roman Gushchin <roman.gushchin@...ux.dev>, 
	Shakeel Butt <shakeel.butt@...ux.dev>, Johannes Weiner <hannes@...xchg.org>, 
	Barry Song <baohua@...nel.org>, Michal Hocko <mhocko@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] mm, memcontrol: avoid duplicated memcg enable check

On Tue, Dec 3, 2024 at 3:11 AM Yosry Ahmed <yosryahmed@...gle.com> wrote:
>
> On Mon, Dec 2, 2024 at 10:42 AM Kairui Song <ryncsn@...il.com> wrote:
> >
> > From: Kairui Song <kasong@...cent.com>
> >
> > mem_cgroup_uncharge_swap() implies a mem_cgroup_disabled() check,
> > which is already checked by the caller here. Skip it by calling
> > __mem_cgroup_uncharge_swap() directly.
> >
> > Signed-off-by: Kairui Song <kasong@...cent.com>
> > ---
> >  mm/memcontrol.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 7b3503d12aaf..d3d1eb506eee 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -4615,7 +4615,7 @@ void mem_cgroup_swapin_uncharge_swap(swp_entry_t entry, unsigned int nr_pages)
> >                  * let's not wait for it.  The page already received a
> >                  * memory+swap charge, drop the swap entry duplicate.
> >                  */
> > -               mem_cgroup_uncharge_swap(entry, nr_pages);
> > +               __mem_cgroup_uncharge_swap(entry, nr_pages);
>
> Would it be better to instead remove the mem_cgroup_disabled() check
> here and have a single check in this path?

Good suggestion, and the kernel test bot just reported
__mem_cgroup_uncharge_swap is undefined with !CONFIG_SWAP, so better
to fix it by removing the check instead.

>
> Anyway, FWIW:
>
> Reviewed-by: Yosry Ahmed <yosryahmed@...gle.com>
>
> >         }
> >  }
> >
> > --
> > 2.47.0
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ