The patch titled Subject: mm/demotion: drop memtier from memtype has been added to the -mm mm-unstable branch. Its filename is mm-demotion-drop-memtier-from-memtype.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-demotion-drop-memtier-from-memtype.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxx> Subject: mm/demotion: drop memtier from memtype Date: Thu, 18 Aug 2022 18:40:39 +0530 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@xxxxxxxxxxxxx Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx> Reviewed-by: "Huang, Ying" <ying.huang@xxxxxxxxx> Cc: Alistair Popple <apopple@xxxxxxxxxx> Cc: Bharata B Rao <bharata@xxxxxxx> Cc: Dan Williams <dan.j.williams@xxxxxxxxx> Cc: Dave Hansen <dave.hansen@xxxxxxxxx> Cc: Davidlohr Bueso <dave@xxxxxxxxxxxx> Cc: Hesham Almatary <hesham.almatary@xxxxxxxxxx> Cc: Jagdish Gediya <jvgediya.oss@xxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Tim Chen <tim.c.chen@xxxxxxxxx> Cc: Wei Xu <weixugc@xxxxxxxxxx> Cc: Yang Shi <shy828301@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/memory-tiers.h | 1 - mm/memory-tiers.c | 16 +++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) --- a/include/linux/memory-tiers.h~mm-demotion-drop-memtier-from-memtype +++ a/include/linux/memory-tiers.h @@ -28,7 +28,6 @@ struct memory_dev_type { /* Nodes of same abstract distance */ nodemask_t nodes; struct kref kref; - struct memory_tier *memtier; }; #ifdef CONFIG_NUMA --- a/mm/memory-tiers.c~mm-demotion-drop-memtier-from-memtype +++ a/mm/memory-tiers.c @@ -100,17 +100,22 @@ static struct memory_tier *find_create_m 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, * just return that. */ - if (memtype->memtier) - return memtype->memtier; + if (!list_empty(&memtype->tier_sibiling)) { + 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) { if (adistance == memtier->adistance_start) { - memtype->memtier = memtier; list_add(&memtype->tier_sibiling, &memtier->memory_types); return memtier; } else if (adistance < memtier->adistance_start) { @@ -130,7 +135,6 @@ static struct memory_tier *find_create_m list_add_tail(&new_memtier->list, &memtier->list); else list_add_tail(&new_memtier->list, &memory_tiers); - memtype->memtier = new_memtier; list_add(&memtype->tier_sibiling, &new_memtier->memory_types); return new_memtier; } @@ -357,7 +361,6 @@ static bool clear_node_memory_tier(int n node_clear(node, memtype->nodes); if (nodes_empty(memtype->nodes)) { list_del(&memtype->tier_sibiling); - memtype->memtier = NULL; if (list_empty(&memtier->memory_types)) destroy_memory_tier(memtier); } @@ -385,7 +388,6 @@ struct memory_dev_type *alloc_memory_typ memtype->adistance = adistance; INIT_LIST_HEAD(&memtype->tier_sibiling); memtype->nodes = NODE_MASK_NONE; - memtype->memtier = NULL; kref_init(&memtype->kref); return memtype; } _ Patches currently in -mm which might be from aneesh.kumar@xxxxxxxxxxxxx are mm-demotion-add-support-for-explicit-memory-tiers.patch mm-demotion-move-memory-demotion-related-code.patch mm-demotion-add-hotplug-callbacks-to-handle-new-numa-node-onlined.patch mm-demotion-dax-kmem-set-nodes-abstract-distance-to-memtier_default_dax_adistance.patch mm-demotion-build-demotion-targets-based-on-explicit-memory-tiers.patch mm-demotion-add-pg_data_t-member-to-track-node-memory-tier-details.patch mm-demotion-drop-memtier-from-memtype.patch mm-demotion-update-node_is_toptier-to-work-with-memory-tiers.patch lib-nodemask-optimize-node_random-for-nodemask-with-single-numa-node.patch