Re: [RFC PATCH v4 4/7] mm/demotion/dax/kmem: Set node's memory tier to MEMORY_TIER_PMEM
From: Bharata B Rao
Date: Mon Jun 06 2022 - 08:10:24 EST
On 6/6/2022 5:24 PM, Aneesh Kumar K.V wrote:
> Aneesh Kumar K V <aneesh.kumar@xxxxxxxxxxxxx> writes:
>>
> Can you try this change?
>
> diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
> index 7a11c387fbbc..905609260dda 100644
> --- a/drivers/dax/kmem.c
> +++ b/drivers/dax/kmem.c
> @@ -94,6 +94,17 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax)
> goto err_reg_mgid;
> data->mgid = rc;
>
> + /*
> + * This get called before the node is brought online. That
> + * is because depending on the value of mhp_default_online_type
> + * the kernel will online the memory along with hotplug
> + * operation. Add the new memory tier before we try to bring
> + * memory blocks online. Otherwise new node will get added to
> + * the default memory tier via hotplug callbacks.
> + */
> +#ifdef CONFIG_TIERED_MEMORY
> + node_set_memory_tier(numa_node, MEMORY_TIER_PMEM);
> +#endif
> for (i = 0; i < dev_dax->nr_range; i++) {
> struct resource *res;
> struct range range;
> @@ -148,9 +159,6 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax)
>
> dev_set_drvdata(dev, data);
>
> -#ifdef CONFIG_TIERED_MEMORY
> - node_set_memory_tier(numa_node, MEMORY_TIER_PMEM);
> -#endif
> return 0;
>
> err_request_mem:
Yes, this fixes the issue for me. Thanks.
Regards,
Bharata.