From: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
To: Alistair Popple <apopple@nvidia.com>
Cc: linux-mm@kvack.org, akpm@linux-foundation.org,
Wei Xu <weixugc@google.com>, Huang Ying <ying.huang@intel.com>,
Yang Shi <shy828301@gmail.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Tim C Chen <tim.c.chen@intel.com>,
Michal Hocko <mhocko@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Hesham Almatary <hesham.almatary@huawei.com>,
Dave Hansen <dave.hansen@intel.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Dan Williams <dan.j.williams@intel.com>,
Johannes Weiner <hannes@cmpxchg.org>,
jvgediya.oss@gmail.com
Subject: Re: [PATCH v9 5/8] mm/demotion: Build demotion targets based on explicit memory tiers
Date: Fri, 15 Jul 2022 12:51:51 +0530 [thread overview]
Message-ID: <87zghau9gw.fsf@linux.ibm.com> (raw)
In-Reply-To: <87cze6apeo.fsf@nvdebian.thelocal>
Alistair Popple <apopple@nvidia.com> writes:
....
> + */
>> +static void establish_migration_targets(void)
>> +{
>> + struct memory_tier *memtier;
>> + struct demotion_nodes *nd;
>> + int target = NUMA_NO_NODE, node;
>> + int distance, best_distance;
>> + nodemask_t used;
>> +
>> + if (!node_demotion || !IS_ENABLED(CONFIG_MIGRATION))
>
> Does it make sense to include the memory tiering/demotion code if
> CONFIG_MIGRATION isn't enabled? From what I can tell none of the
> information established here is used if CONFIG_MIGRATION isn't enabled,
> so it would be better to remove the IS_ENABLED checks and not include
> the code at all.
We use the same function/codepath for updating top_tier details. We
would want to get node_is_toptier() to work even with CONFIG_MIGRATION
disabled?
>
>> + return;
>> +
>> + disable_all_migrate_targets();
>> +
>> + for_each_node_state(node, N_MEMORY) {
>> + best_distance = -1;
>> + nd = &node_demotion[node];
>> +
>> + memtier = __node_get_memory_tier(node);
>> + if (!memtier || list_is_last(&memtier->list, &memory_tiers))
>> + continue;
>> + /*
>> + * Get the next memtier to find the demotion node list.
>> + */
>> + memtier = list_next_entry(memtier, list);
>> +
>> + /*
>> + * find_next_best_node, use 'used' nodemask as a skip list.
>> + * Add all memory nodes except the selected memory tier
>> + * nodelist to skip list so that we find the best node from the
>> + * memtier nodelist.
>> + */
>> + nodes_andnot(used, node_states[N_MEMORY], memtier->nodelist);
>> +
>> + /*
>> + * Find all the nodes in the memory tier node list of same best distance.
>> + * add them to the preferred mask. We randomly select between nodes
>> + * in the preferred mask when allocating pages during demotion.
>> + */
>> + do {
>> + target = find_next_best_node(node, &used);
>> + if (target == NUMA_NO_NODE)
>> + break;
>> +
>> + distance = node_distance(node, target);
>> + if (distance == best_distance || best_distance == -1) {
>> + best_distance = distance;
>> + node_set(target, nd->preferred);
>> + } else {
>> + break;
>> + }
>> + } while (1);
>> + }
>> +}
>> +
.....
-aneesh
next prev parent reply other threads:[~2022-07-15 7:22 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 4:53 [PATCH v9 0/8] mm/demotion: Memory tiers and demotion Aneesh Kumar K.V
2022-07-14 4:53 ` [PATCH v9 1/8] mm/demotion: Add support for explicit memory tiers Aneesh Kumar K.V
2022-07-15 7:53 ` Huang, Ying
2022-07-15 9:08 ` Aneesh Kumar K V
2022-07-15 9:24 ` Aneesh Kumar K V
2022-07-15 10:27 ` Aneesh Kumar K.V
2022-07-18 6:08 ` Huang, Ying
2022-07-18 6:57 ` Huang, Ying
2022-07-18 8:00 ` Aneesh Kumar K V
2022-07-18 8:55 ` Huang, Ying
2022-07-15 16:59 ` Wei Xu
2022-07-18 5:28 ` Huang, Ying
2022-07-18 5:58 ` Alistair Popple
2022-07-18 6:56 ` Aneesh Kumar K V
2022-07-14 4:53 ` [PATCH v9 2/8] mm/demotion: Move memory demotion related code Aneesh Kumar K.V
2022-07-14 4:53 ` [PATCH v9 3/8] mm/demotion/dax/kmem: Set node's memory tier to MEMORY_TIER_PMEM Aneesh Kumar K.V
2022-07-14 4:53 ` [PATCH v9 4/8] mm/demotion: Add hotplug callbacks to handle new numa node onlined Aneesh Kumar K.V
2022-07-15 4:38 ` Alistair Popple
2022-07-15 7:23 ` Aneesh Kumar K.V
2022-07-14 4:53 ` [PATCH v9 5/8] mm/demotion: Build demotion targets based on explicit memory tiers Aneesh Kumar K.V
2022-07-15 4:47 ` Alistair Popple
2022-07-15 7:21 ` Aneesh Kumar K.V [this message]
2022-07-18 5:41 ` Alistair Popple
2022-07-14 4:53 ` [PATCH v9 6/8] mm/demotion: Add pg_data_t member to track node memory tier details Aneesh Kumar K.V
2022-07-15 5:49 ` Alistair Popple
2022-07-15 7:19 ` Aneesh Kumar K.V
2022-07-18 5:22 ` Alistair Popple
2022-07-14 4:53 ` [PATCH v9 7/8] mm/demotion: Demote pages according to allocation fallback order Aneesh Kumar K.V
2022-07-14 4:53 ` [PATCH v9 8/8] mm/demotion: Update node_is_toptier to work with memory tiers Aneesh Kumar K.V
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zghau9gw.fsf@linux.ibm.com \
--to=aneesh.kumar@linux.ibm.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@intel.com \
--cc=dave@stgolabs.net \
--cc=hannes@cmpxchg.org \
--cc=hesham.almatary@huawei.com \
--cc=jvgediya.oss@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=shy828301@gmail.com \
--cc=tim.c.chen@intel.com \
--cc=weixugc@google.com \
--cc=ying.huang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox