Commit b26ac6f3 authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Andrew Morton

mm/demotion: drop memtier from memtype

Now that we track node-specific memtier in pg_data_t, we can drop memtier
from memtype.

Link: https://lkml.kernel.org/r/20220818131042.113280-8-aneesh.kumar@linux.ibm.comSigned-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Reviewed-by: default avatar"Huang, Ying" <ying.huang@intel.com>
Acked-by: default avatarWei Xu <weixugc@google.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Bharata B Rao <bharata@amd.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Hesham Almatary <hesham.almatary@huawei.com>
Cc: Jagdish Gediya <jvgediya.oss@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Tim Chen <tim.c.chen@intel.com>
Cc: Yang Shi <shy828301@gmail.com>
Cc: SeongJae Park <sj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 7766cf7a
...@@ -28,7 +28,6 @@ struct memory_dev_type { ...@@ -28,7 +28,6 @@ struct memory_dev_type {
/* Nodes of same abstract distance */ /* Nodes of same abstract distance */
nodemask_t nodes; nodemask_t nodes;
struct kref kref; struct kref kref;
struct memory_tier *memtier;
}; };
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
......
...@@ -105,17 +105,22 @@ static struct memory_tier *find_create_memory_tier(struct memory_dev_type *memty ...@@ -105,17 +105,22 @@ static struct memory_tier *find_create_memory_tier(struct memory_dev_type *memty
lockdep_assert_held_once(&memory_tier_lock); lockdep_assert_held_once(&memory_tier_lock);
adistance = round_down(adistance, memtier_adistance_chunk_size);
/* /*
* If the memtype is already part of a memory tier, * If the memtype is already part of a memory tier,
* just return that. * just return that.
*/ */
if (memtype->memtier) if (!list_empty(&memtype->tier_sibiling)) {
return memtype->memtier; list_for_each_entry(memtier, &memory_tiers, list) {
if (adistance == memtier->adistance_start)
return memtier;
}
WARN_ON(1);
return ERR_PTR(-EINVAL);
}
adistance = round_down(adistance, memtier_adistance_chunk_size);
list_for_each_entry(memtier, &memory_tiers, list) { list_for_each_entry(memtier, &memory_tiers, list) {
if (adistance == memtier->adistance_start) { if (adistance == memtier->adistance_start) {
memtype->memtier = memtier;
list_add(&memtype->tier_sibiling, &memtier->memory_types); list_add(&memtype->tier_sibiling, &memtier->memory_types);
return memtier; return memtier;
} else if (adistance < memtier->adistance_start) { } else if (adistance < memtier->adistance_start) {
...@@ -135,7 +140,6 @@ static struct memory_tier *find_create_memory_tier(struct memory_dev_type *memty ...@@ -135,7 +140,6 @@ static struct memory_tier *find_create_memory_tier(struct memory_dev_type *memty
list_add_tail(&new_memtier->list, &memtier->list); list_add_tail(&new_memtier->list, &memtier->list);
else else
list_add_tail(&new_memtier->list, &memory_tiers); list_add_tail(&new_memtier->list, &memory_tiers);
memtype->memtier = new_memtier;
list_add(&memtype->tier_sibiling, &new_memtier->memory_types); list_add(&memtype->tier_sibiling, &new_memtier->memory_types);
return new_memtier; return new_memtier;
} }
...@@ -372,7 +376,6 @@ static bool clear_node_memory_tier(int node) ...@@ -372,7 +376,6 @@ static bool clear_node_memory_tier(int node)
node_clear(node, memtype->nodes); node_clear(node, memtype->nodes);
if (nodes_empty(memtype->nodes)) { if (nodes_empty(memtype->nodes)) {
list_del_init(&memtype->tier_sibiling); list_del_init(&memtype->tier_sibiling);
memtype->memtier = NULL;
if (list_empty(&memtier->memory_types)) if (list_empty(&memtier->memory_types))
destroy_memory_tier(memtier); destroy_memory_tier(memtier);
} }
...@@ -400,7 +403,6 @@ struct memory_dev_type *alloc_memory_type(int adistance) ...@@ -400,7 +403,6 @@ struct memory_dev_type *alloc_memory_type(int adistance)
memtype->adistance = adistance; memtype->adistance = adistance;
INIT_LIST_HEAD(&memtype->tier_sibiling); INIT_LIST_HEAD(&memtype->tier_sibiling);
memtype->nodes = NODE_MASK_NONE; memtype->nodes = NODE_MASK_NONE;
memtype->memtier = NULL;
kref_init(&memtype->kref); kref_init(&memtype->kref);
return memtype; return memtype;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment