linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Oscar Salvador <osalvador@suse.de>
Cc: Byungchul Park <byungchul@sk.com>,
	mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	bristot@redhat.com, vschneid@redhat.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	kernel_team@skhynix.com, akpm@linux-foundation.org,
	fan.ni@samsung.com
Subject: Re: [PATCH v3] sched/numa, mm: do not promote folios to nodes not set N_MEMORY
Date: Mon, 19 Feb 2024 11:26:15 -0800	[thread overview]
Message-ID: <20240219192615.adgr4cfknnb356de@offworld> (raw)
In-Reply-To: <ZdG1yO29WTyRiw8Q@localhost.localdomain>

On Sun, 18 Feb 2024, Oscar Salvador wrote:

>On Fri, Feb 16, 2024 at 02:51:24PM +0100, Oscar Salvador wrote:
>> On Fri, Feb 16, 2024 at 08:40:45PM +0900, Byungchul Park wrote:
>> > From 150af2f78e19217a1d03e47e3ee5279684590fb4 Mon Sep 17 00:00:00 2001
>> > From: Byungchul Park <byungchul@sk.com>
>> > Date: Fri, 16 Feb 2024 20:18:10 +0900
>> > Subject: [PATCH v3] sched/numa, mm: do not promote folios to nodes not set N_MEMORY
>>
>> "do not try to promote folios to memoryless nodes"
>
>Thinking some more, promote might be misleading, just something like
>"do not try to migrate memory to memoryless nodes".

Yes. Does this also want an unlikely()? Not that it would be measurable.

>As this is not a bug fix but an optimization, as we will fail anyways
>in migrate_misplaced_folio() when migrate_balanced_pgdat() notices that
>we do not have any memory on that code.

This should be in the changelog and the subject is misleading as well.

Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>

>
>With the other comments addressed:
>
>Reviewed-by: Oscar Salvador <osalvador@suse.de>
>
>>
>> because AFAICS we are just trying.
>> Even if should_numa_migrate_memory() returns true, I assume that we will
>> fail somewhere down the chain e.g: migrate_pages() when we see that this
>> node does not any memory, right?
>>
>> > A numa node might not have its local memory but CPUs. Promoting a folio
>> > to the node's local memory is nonsense. So avoid nodes not set N_MEMORY
>> > from getting promoted.
>>
>> If you talk about memoryless nodes everybody gets it better IMHO.
>> "Memoryless nodes do not have any memory to migrate to, so stop trying it."
>>
>>
>> > Signed-off-by: Byungchul Park <byungchul@sk.com>
>> > ---
>> >  kernel/sched/fair.c | 7 +++++++
>> >  1 file changed, 7 insertions(+)
>> >
>> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> > index d7a3c63a2171..7ed9ef3c0134 100644
>> > --- a/kernel/sched/fair.c
>> > +++ b/kernel/sched/fair.c
>> > @@ -1828,6 +1828,13 @@ bool should_numa_migrate_memory(struct task_struct *p, struct folio *folio,
>> >  	int dst_nid = cpu_to_node(dst_cpu);
>> >  	int last_cpupid, this_cpupid;
>> >
>> > +	/*
>> > +	 * A node of dst_nid might not have its local memory. Promoting
>> > +	 * a folio to the node is meaningless.
>> > +	 */
>> > +	if (!node_state(dst_nid, N_MEMORY))
>> > +		return false;
>>
>> "Cannot migrate to memoryless nodes"
>>
>> seems shorter and more clear.
>>
>> So, what happens when we return true here? will we fail at
>> migrate_pages() I guess? That is quite down the road so I guess
>> this check can save us some time.
>>
>>
>> --
>> Oscar Salvador
>> SUSE Labs
>>
>
>-- 
>Oscar Salvador
>SUSE Labs
>


  parent reply	other threads:[~2024-02-19 19:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 11:40 Byungchul Park
2024-02-16 13:51 ` Oscar Salvador
2024-02-18  7:46   ` Oscar Salvador
2024-02-19  2:10     ` Byungchul Park
2024-02-19 19:26     ` Davidlohr Bueso [this message]
2024-02-19  2:08   ` Byungchul Park
2024-02-19 15:00     ` Phil Auld
2024-02-19  9:30 ` David Hildenbrand

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=20240219192615.adgr4cfknnb356de@offworld \
    --to=dave@stgolabs.net \
    --cc=akpm@linux-foundation.org \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=byungchul@sk.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=fan.ni@samsung.com \
    --cc=juri.lelli@redhat.com \
    --cc=kernel_team@skhynix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=osalvador@suse.de \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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