From: David Hildenbrand <david@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Donet Tom <donettom@linux.ibm.com>
Subject: Re: [PATCH v1 2/2] mm/migrate: move NUMA hinting fault folio isolation + checks under PTL
Date: Wed, 26 Jun 2024 18:22:26 +0200 [thread overview]
Message-ID: <8f85c31a-e603-4578-bf49-136dae0d4b69@redhat.com> (raw)
In-Reply-To: <20240620212935.656243-3-david@redhat.com>
On 20.06.24 23:29, David Hildenbrand wrote:
> Currently we always take a folio reference even if migration will not
> even be tried or isolation failed, requiring us to grab+drop an additional
> reference.
>
> Further, we end up calling folio_likely_mapped_shared() while the folio
> might have already been unmapped, because after we dropped the PTL, that
> can easily happen. We want to stop touching mapcounts and friends from
> such context, and only call folio_likely_mapped_shared() while the folio
> is still mapped: mapcount information is pretty much stale and unreliable
> otherwise.
>
> So let's move checks into numamigrate_isolate_folio(), rename that
> function to migrate_misplaced_folio_prepare(), and call that function
> from callsites where we call migrate_misplaced_folio(), but still with
> the PTL held.
>
> We can now stop taking temporary folio references, and really only take
> a reference if folio isolation succeeded. Doing the
> folio_likely_mapped_shared() + golio isolation under PT lock is now similar
> to how we handle MADV_PAGEOUT.
>
> While at it, combine the folio_is_file_lru() checks.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
Donet just reported an issue. I suspect this fixes it -- in any case, this is
the right thing to do.
From 0833b9896e98c8d88c521609c811a220d14a2e7e Mon Sep 17 00:00:00 2001
From: David Hildenbrand <david@redhat.com>
Date: Wed, 26 Jun 2024 18:14:44 +0200
Subject: [PATCH] Fixup: mm/migrate: move NUMA hinting fault folio isolation +
checks under PTL
Donet reports an issue during NUMA migration we haven't seen previously:
[ 71.422804] list_del corruption, c00c00000061b3c8->next is
LIST_POISON1 (5deadbeef0000100)
[ 71.422839] ------------[ cut here ]------------
[ 71.422843] kernel BUG at lib/list_debug.c:56!
[ 71.422850] Oops: Exception in kernel mode, sig: 5 [#1]
We forgot to convert one "return 0;" to return an error instead from
migrate_misplaced_folio_prepare() in case the target node is nearly
full.
Signed-off-by: David Hildenbrand <david@redhat.com>
---
mm/migrate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/migrate.c b/mm/migrate.c
index 8beedbb42a93..9ed43c1eea5e 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -2564,7 +2564,7 @@ int migrate_misplaced_folio_prepare(struct folio *folio,
int z;
if (!(sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING))
- return 0;
+ return -EAGAIN;
for (z = pgdat->nr_zones - 1; z >= 0; z--) {
if (managed_zone(pgdat->node_zones + z))
break;
base-commit: 4b17ce353e02b47b00e2fe87b862f09e8b9a47e6
--
2.45.2
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-06-26 16:22 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 21:29 [PATCH v1 0/2] mm/migrate: move NUMA hinting fault folio isolation + checks under PTL David Hildenbrand
2024-06-20 21:29 ` [PATCH v1 1/2] mm/migrate: make migrate_misplaced_folio() return 0 on success David Hildenbrand
2024-06-21 1:40 ` Zi Yan
2024-06-21 3:39 ` Baolin Wang
2024-07-01 7:36 ` Huang, Ying
2024-07-01 7:44 ` David Hildenbrand
2024-06-20 21:29 ` [PATCH v1 2/2] mm/migrate: move NUMA hinting fault folio isolation + checks under PTL David Hildenbrand
2024-06-21 2:05 ` Zi Yan
2024-06-21 7:32 ` David Hildenbrand
2024-06-21 4:07 ` Baolin Wang
2024-06-21 7:31 ` David Hildenbrand
2024-06-21 13:44 ` Zi Yan
2024-06-21 20:18 ` David Hildenbrand
2024-06-21 20:48 ` Zi Yan
2024-06-26 16:49 ` David Hildenbrand
2024-06-26 17:37 ` Zi Yan
2024-07-01 8:32 ` Huang, Ying
2024-07-01 13:50 ` Zi Yan
2024-07-01 14:03 ` David Hildenbrand
2024-07-01 14:04 ` Zi Yan
2024-06-21 17:47 ` Donet Tom
2024-06-21 20:14 ` David Hildenbrand
2024-06-26 16:22 ` David Hildenbrand [this message]
2024-06-27 6:00 ` Donet Tom
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=8f85c31a-e603-4578-bf49-136dae0d4b69@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=donettom@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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;
as well as URLs for NNTP newsgroup(s).