Alistair Popple <apopple@xxxxxxxxxx> writes: > "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxx> writes: > >> If the new NUMA node onlined doesn't have a memory tier assigned, >> the kernel adds the NUMA node to default memory tier. >> >> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx> >> --- >> mm/memory-tiers.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 68 insertions(+) >> >> diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c >> index 79347d4ab05e..5706ad647136 100644 >> --- a/mm/memory-tiers.c >> +++ b/mm/memory-tiers.c >> @@ -5,6 +5,7 @@ >> #include <linux/slab.h> >> #include <linux/lockdep.h> >> #include <linux/moduleparam.h> >> +#include <linux/memory.h> >> #include <linux/memory-tiers.h> >> >> struct memory_tier { >> @@ -130,8 +131,73 @@ int node_create_and_set_memory_tier(int node, int tier) >> } >> EXPORT_SYMBOL_GPL(node_create_and_set_memory_tier); >> >> +static int __node_set_memory_tier(int node, int tier) >> +{ >> + int ret = 0; >> + struct memory_tier *memtier; >> + >> + memtier = __get_memory_tier_from_id(tier); >> + if (!memtier) { >> + ret = -EINVAL; >> + goto out; >> + } >> + node_set(node, memtier->nodelist); >> +out: >> + return ret; >> +} >> + >> +static int node_set_memory_tier(int node, int tier) > > Minor comment, but I don't like the name of this function as it doesn't > always set the node to the given tier. > > Something like this would make it clearer the tier value is only used if > the node isn't already assigned to a tier: > > static int init_node_memory_tier(int node, int default_tier) > Will rename to init_node_memory_tier() -aneesh