linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Byungchul Park <byungchul@sk.com>,
	akpm@linux-foundation.org, ying.huang@intel.com,
	hannes@cmpxchg.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, kernel_team@skhynix.com,
	stable@vger.kernel.org
Subject: Re: [PATCH] mm/vmscan: Fix a bug calling wakeup_kswapd() with a wrong zone index
Date: Mon, 19 Feb 2024 09:11:06 +0100	[thread overview]
Message-ID: <ZdMNGvUOWnNn9zDh@localhost.localdomain> (raw)
In-Reply-To: <517e58d4-7537-4d9f-8893-0130c65c3fdb@linux.alibaba.com>

On Mon, Feb 19, 2024 at 02:25:11PM +0800, Baolin Wang wrote:
> This means that there is no memory on the target node? if so, we can add a
> check at the beginning to avoid calling unnecessary
> migrate_misplaced_folio().
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index e95503d7544e..a64a1aac463f 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -5182,7 +5182,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
>         else
>                 last_cpupid = folio_last_cpupid(folio);
>         target_nid = numa_migrate_prep(folio, vma, vmf->address, nid,
> &flags);
> -       if (target_nid == NUMA_NO_NODE) {
> +       if (target_nid == NUMA_NO_NODE || !node_state(target_nid, N_MEMORY))
> {
>                 folio_put(folio);
>                 goto out_map;
>         }
> 
> (similar changes for do_huge_pmd_numa_page())

With the check in place from [1], numa_migrate_prep() will also return
NUMA_NO_NODE, so no need for this one here.

And I did not check, but I assume that do_huge_pmd_numa_page() also ends
up calling numa_migrate_prep().

[1] https://lore.kernel.org/lkml/20240219041920.1183-1-byungchul@sk.com/
 

-- 
Oscar Salvador
SUSE Labs


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

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-16 11:15 Byungchul Park
2024-02-19  6:25 ` Baolin Wang
2024-02-19  6:31   ` Byungchul Park
2024-02-19  8:11   ` Oscar Salvador [this message]
2024-02-19  9:54     ` Baolin Wang
2024-02-20  3:42 ` Huang, Ying
2024-02-20  4:03   ` Byungchul Park
2024-02-20  5:29     ` Huang, Ying

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=ZdMNGvUOWnNn9zDh@localhost.localdomain \
    --to=osalvador@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=byungchul@sk.com \
    --cc=hannes@cmpxchg.org \
    --cc=kernel_team@skhynix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=stable@vger.kernel.org \
    --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