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]
Date: Thu, 28 Mar 2024 09:35:22 +0800
From: "Huang, Ying" <ying.huang@...el.com>
To: "Ho-Ren (Jack) Chuang" <horenchuang@...edance.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: [PATCH v6 2/2] memory tier: create CPUless memory tiers after
 obtaining HMAT info

"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.

> +			/*
> +			 * 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ