[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2ir5ul6baqj7dk6uw5opwnsxuxfmobtoehyfxglnsadlrcurjs@7akcf3auqink>
Date: Wed, 16 Jul 2025 10:08:28 +0200
From: "Pankaj Raghav (Samsung)" <kernel@...kajraghav.com>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: Suren Baghdasaryan <surenb@...gle.com>,
Ryan Roberts <ryan.roberts@....com>, Baolin Wang <baolin.wang@...ux.alibaba.com>,
Borislav Petkov <bp@...en8.de>, Ingo Molnar <mingo@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>, Vlastimil Babka <vbabka@...e.cz>, Zi Yan <ziy@...dia.com>,
Mike Rapoport <rppt@...nel.org>, Dave Hansen <dave.hansen@...ux.intel.com>,
Michal Hocko <mhocko@...e.com>, David Hildenbrand <david@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>, Thomas Gleixner <tglx@...utronix.de>,
Nico Pache <npache@...hat.com>, Dev Jain <dev.jain@....com>,
"Liam R . Howlett" <Liam.Howlett@...cle.com>, Jens Axboe <axboe@...nel.dk>, linux-kernel@...r.kernel.org,
willy@...radead.org, linux-mm@...ck.org, x86@...nel.org, linux-block@...r.kernel.org,
linux-fsdevel@...r.kernel.org, "Darrick J . Wong" <djwong@...nel.org>, mcgrof@...nel.org,
gost.dev@...sung.com, hch@....de, Pankaj Raghav <p.raghav@...sung.com>
Subject: Re: [PATCH v2 2/5] huge_memory: add
huge_zero_page_shrinker_(init|exit) function
On Tue, Jul 15, 2025 at 03:29:08PM +0100, Lorenzo Stoakes wrote:
> Nit on subject, function -> functions.
>
> On Mon, Jul 07, 2025 at 04:23:16PM +0200, Pankaj Raghav (Samsung) wrote:
> > From: Pankaj Raghav <p.raghav@...sung.com>
> >
> > Add huge_zero_page_shrinker_init() and huge_zero_page_shrinker_exit().
> > As shrinker will not be needed when static PMD zero page is enabled,
> > these two functions can be a no-op.
> >
> > This is a preparation patch for static PMD zero page. No functional
> > changes.
>
> This is nitty stuff, but I think this is a little unclear, maybe something
> like:
>
> We will soon be determining whether to use a shrinker depending on
> whether a static PMD zero page is available, therefore abstract out
> shrink initialisation and teardown such that we can more easily
> handle both the shrinker and static PMD zero page cases.
>
This looks good. I will use add this to the commit message.
> >
> > Signed-off-by: Pankaj Raghav <p.raghav@...sung.com>
>
> Other than nits, this LGTM, so with those addressed:
>
> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Thanks.
> > #ifdef CONFIG_SYSFS
> > static ssize_t enabled_show(struct kobject *kobj,
> > @@ -850,33 +868,31 @@ static inline void hugepage_exit_sysfs(struct kobject *hugepage_kobj)
> >
> > static int __init thp_shrinker_init(void)
> > {
> > - huge_zero_page_shrinker = shrinker_alloc(0, "thp-zero");
> > - if (!huge_zero_page_shrinker)
> > - return -ENOMEM;
> > + int ret = 0;
>
> Kinda no point in initialising to zero, unless...
>
> >
> > deferred_split_shrinker = shrinker_alloc(SHRINKER_NUMA_AWARE |
> > SHRINKER_MEMCG_AWARE |
> > SHRINKER_NONSLAB,
> > "thp-deferred_split");
> > - if (!deferred_split_shrinker) {
> > - shrinker_free(huge_zero_page_shrinker);
> > + if (!deferred_split_shrinker)
> > return -ENOMEM;
> > - }
> > -
> > - huge_zero_page_shrinker->count_objects = shrink_huge_zero_page_count;
> > - huge_zero_page_shrinker->scan_objects = shrink_huge_zero_page_scan;
> > - shrinker_register(huge_zero_page_shrinker);
> >
> > deferred_split_shrinker->count_objects = deferred_split_count;
> > deferred_split_shrinker->scan_objects = deferred_split_scan;
> > shrinker_register(deferred_split_shrinker);
> >
> > + ret = huge_zero_page_shrinker_init();
> > + if (ret) {
> > + shrinker_free(deferred_split_shrinker);
> > + return ret;
> > + }
>
> ... you change this to:
>
> if (ret)
> shrinker_free(deferred_split_shrinker);
>
> return ret;
>
> But it's not a big deal. Maybe I'd rename ret -> err if you keep things as
> they are (but don't init to 0).
Sounds good.
--
Pankaj
Powered by blists - more mailing lists