[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKPbEqrhBLQ67ciUTukGTB0eC3G_JHcTEMfbiw_PtnGBSv=ksw@mail.gmail.com>
Date: Thu, 28 Mar 2024 00:54:13 -0700
From: "Ho-Ren (Jack) Chuang" <horenchuang@...edance.com>
To: "Huang, Ying" <ying.huang@...el.com>
Cc: Gregory Price <gourry.memverge@...il.com>, aneesh.kumar@...ux.ibm.com, mhocko@...e.com,
tj@...nel.org, john@...alactic.com, Eishan Mirakhur <emirakhur@...ron.com>,
Vinicius Tavares Petrucci <vtavarespetr@...ron.com>, Ravis OpenSrc <Ravis.OpenSrc@...ron.com>,
Alistair Popple <apopple@...dia.com>, Srinivasulu Thanneeru <sthanneeru@...ron.com>,
Dan Williams <dan.j.williams@...el.com>, Vishal Verma <vishal.l.verma@...el.com>,
Dave Jiang <dave.jiang@...el.com>, Andrew Morton <akpm@...ux-foundation.org>, nvdimm@...ts.linux.dev,
linux-cxl@...r.kernel.org, linux-kernel@...r.kernel.org, linux-mm@...ck.org,
"Ho-Ren (Jack) Chuang" <horenc@...edu>, "Ho-Ren (Jack) Chuang" <horenchuang@...il.com>, qemu-devel@...gnu.org,
Hao Xiang <hao.xiang@...edance.com>
Subject: Re: [External] Re: [PATCH v6 2/2] memory tier: create CPUless memory
tiers after obtaining HMAT info
On Wed, Mar 27, 2024 at 6:37 PM Huang, Ying <ying.huang@...el.com> wrote:
>
> "Ho-Ren (Jack) Chuang" <horenchuang@...edance.com> writes:
>
> [snip]
>
> > @@ -655,6 +672,34 @@ void mt_put_memory_types(struct list_head *memory_types)
> > }
> > EXPORT_SYMBOL_GPL(mt_put_memory_types);
> >
> > +/*
> > + * This is invoked via `late_initcall()` to initialize memory tiers for
> > + * CPU-less memory nodes after driver initialization, which is
> > + * expected to provide `adistance` algorithms.
> > + */
> > +static int __init memory_tier_late_init(void)
> > +{
> > + int nid;
> > +
> > + mutex_lock(&memory_tier_lock);
> > + for_each_node_state(nid, N_MEMORY)
> > + if (!node_state(nid, N_CPU) &&
> > + node_memory_types[nid].memtype == NULL)
>
> Think about this again. It seems that it is better to check
> "node_memory_types[nid].memtype == NULL" only here. Because for all
> node with N_CPU in memory_tier_init(), "node_memory_types[nid].memtype"
> will be !NULL. And it's possible (in theory) that some nodes becomes
> "node_state(nid, N_CPU) == true" between memory_tier_init() and
> memory_tier_late_init().
>
> Otherwise, Looks good to me. Feel free to add
>
> Reviewed-by: "Huang, Ying" <ying.huang@...el.com>
>
> in the future version.
>
Thank you Huang, Ying for your endorsement and
the feedback you've been giving!
> > + /*
> > + * Some device drivers may have initialized memory tiers
> > + * between `memory_tier_init()` and `memory_tier_late_init()`,
> > + * potentially bringing online memory nodes and
> > + * configuring memory tiers. Exclude them here.
> > + */
> > + set_node_memory_tier(nid);
> > +
> > + establish_demotion_targets();
> > + mutex_unlock(&memory_tier_lock);
> > +
> > + return 0;
> > +}
> > +late_initcall(memory_tier_late_init);
> > +
>
> [snip]
>
> --
> Best Regards,
> Huang, Ying
--
Best regards,
Ho-Ren (Jack) Chuang
莊賀任
Powered by blists - more mailing lists