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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAN+CAwPkcLgnrd4qVj-BAv_KYTakTsp3UwmBqs==vGdfaZan=A@mail.gmail.com>
Date: Thu, 7 Nov 2024 10:07:01 -0500
From: Joshua Hahn <joshua.hahnjy@...il.com>
To: Shakeel Butt <shakeel.butt@...ux.dev>
Cc: hannes@...xchg.org, mhocko@...nel.org, roman.gushchin@...ux.dev, 
	muchun.song@...ux.dev, akpm@...ux-foundation.org, cgroups@...r.kernel.org, 
	linux-mm@...ck.org, linux-kernel@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH 2/2] memcg/hugetlb: Deprecate hugetlb memcg
 try-commit-cancel charging

On Wed, Nov 6, 2024 at 6:50 PM Shakeel Butt <shakeel.butt@...ux.dev> wrote:
>
> >
> > -int mem_cgroup_hugetlb_try_charge(struct mem_cgroup *memcg, gfp_t gfp,
> > -             long nr_pages);
> > +int mem_cgroup_charge_hugetlb(struct folio *folio, gfp_t gfp);
>
> Please cleanup mem_cgroup_cancel_charge() and mem_cgroup_commit_charge()
> as well as there will be no users after this patch.
>
> >       /*
> >        * Processes that did not create the mapping will have no
> > @@ -3056,6 +3044,12 @@ struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma,
> >               /* Fall through */
> >       }
> >
> > +     ret = mem_cgroup_charge_hugetlb(folio, gfp);
>
> You can not call this with hugetlb_lock held.
>
> >  {
> > -     /*
> > -      * If hugetlb memcg charging is not enabled, do not fail hugetlb allocation,
> > -      * but do not attempt to commit charge later (or cancel on error) either.
> > -      */
> > -     if (mem_cgroup_disabled() || !memcg ||
> > -             !cgroup_subsys_on_dfl(memory_cgrp_subsys) || !memcg_accounts_hugetlb())
> > +     struct mem_cgroup *memcg = get_mem_cgroup_from_current();
>
> Leaking the above reference in error paths.
>

Hello Shakeel,

Thank you for your feedback on this patch. I will implement the changes you
mentioned in both patches. As for the comment on the other patch about
replacing the accounting check in mem_cgroup_hugetlb_try_charge,
I think this makes more sense. I will move the code from this patch to
the first.

Thank you again, have a great day!
Joshua

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ