From: Jagdish Gediya <jvgediya@xxxxxxxxxxxxx> By default, all nodes are assigned to DEFAULT_MEMORY_TIER which is memory tier 1 which is designated for nodes with DRAM, so it is not the right tier for dax devices. Set dax kmem device node's tier to MEMORY_TIER_PMEM, In future, support should be added to distinguish the dax-devices which should not be MEMORY_TIER_PMEM and right memory tier should be set for them. Signed-off-by: Jagdish Gediya <jvgediya@xxxxxxxxxxxxx> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx> --- drivers/dax/kmem.c | 4 ++++ mm/migrate.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index a37622060fff..991782aa2448 100644 --- a/drivers/dax/kmem.c +++ b/drivers/dax/kmem.c @@ -11,6 +11,7 @@ #include <linux/fs.h> #include <linux/mm.h> #include <linux/mman.h> +#include <linux/migrate.h> #include "dax-private.h" #include "bus.h" @@ -147,6 +148,9 @@ 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: diff --git a/mm/migrate.c b/mm/migrate.c index d819a64db5b1..59d8558dd2ee 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2418,6 +2418,8 @@ int node_set_memory_tier(int node, int tier) return ret; } +EXPORT_SYMBOL_GPL(node_set_memory_tier); + /** * next_demotion_node() - Get the next node in the demotion path -- 2.36.1