[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAN+CAwMMXxBdZQ+vQOsQAtrkEPyq_a=7Y6GQbfuzyUci--N=HQ@mail.gmail.com>
Date: Sat, 9 Nov 2024 13:31:07 -0500
From: Joshua Hahn <joshua.hahnjy@...il.com>
To: Yosry Ahmed <yosryahmed@...gle.com>
Cc: Shakeel Butt <shakeel.butt@...ux.dev>, 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 1/3] memcg/hugetlb: Introduce memcg_accounts_hugetlb
On Fri, Nov 8, 2024 at 6:03 PM Yosry Ahmed <yosryahmed@...gle.com> wrote:
>
> On Fri, Nov 8, 2024 at 2:21 PM Shakeel Butt <shakeel.butt@...ux.dev> wrote:
> >
> > On Fri, Nov 08, 2024 at 01:29:44PM -0800, Joshua Hahn wrote:
> > > This patch isolates the check for whether memcg accounts hugetlb.
> > > This condition can only be true if the memcg mount option
> > > memory_hugetlb_accounting is on, which includes hugetlb usage
> > > in memory.current.
> > >
> > > Signed-off-by: Joshua Hahn <joshua.hahnjy@...il.com>
> > >
> > > ---
> > > mm/memcontrol.c | 17 ++++++++++++++---
> > > 1 file changed, 14 insertions(+), 3 deletions(-)
> > > +/* Forward declaration */
> > > +bool memcg_accounts_hugetlb(void);
> >
> > No need for forward declaration. Just define it here and make it static.
>
> Also please pull the #ifdef outside the function definition, e.g.
>
> #ifdef CONFIG_HUGETLB_PAGE
> static bool memcg_accounts_hugetlb(void)
> {
> return cgrp_dfl_root.flags & CGRP_ROOT_MEMORY_HUGETLB_ACCOUNTING;
> }
> #else /* CONFIG_HUGETLB_PAGE */
> static bool memcg_accounts_hugetlb(void) { return false; }
> {
> return false;
> }
> #endif /* CONFIG_HUGETLB_PAGE */
>
Hello Shakeel and Yosry,
Thank you for taking the time to review my patch.
Yes -- I will just declare the function & make it static. It was my
intention to group the new memcg charging functions together,
and in that effort I just made a forward declaration above.
However, I think that it does make the code look a bit more
messy, which is against the spirit of this patch series!
And Yosry, thank you for your feedback, I will separate the
definitions based on the #ifdef.
Thank you both, I hope you have a great day!
Joshua
Powered by blists - more mailing lists