Re: [PATCH v5 2/9] mm/demotion: Expose per node memory tier to sysfs

From: Tim Chen
Date: Tue Jun 07 2022 - 21:30:11 EST


On Fri, 2022-06-03 at 19:12 +0530, Aneesh Kumar K.V wrote:
>
>
> +static struct memory_tier *__node_get_memory_tier(int node)
> +{
> + struct memory_tier *memtier;
> +
> + list_for_each_entry(memtier, &memory_tiers, list) {

We could need to map node to mem_tier quite often, if we need
to account memory usage at tier level. It will be more efficient
to have a pointer from node (pgdat) to memtier rather
than doing a search through the list.


> + if (node_isset(node, memtier->nodelist))
> + return memtier;
> + }
> + return NULL;
> +}
> +
>

Tim