From: David Hildenbrand <david@redhat.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>, akpm@linux-foundation.org
Cc: ying.huang@intel.com, wangkefeng.wang@huawei.com,
willy@infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] mm: support large folio numa balancing
Date: Wed, 15 Nov 2023 11:46:02 +0100 [thread overview]
Message-ID: <05dbc7b8-2e4a-4762-a6a6-278985d89928@redhat.com> (raw)
In-Reply-To: <a71a478ce404e93683023dbb7248dd95f11554f4.1699872019.git.baolin.wang@linux.alibaba.com>
On 13.11.23 11:45, Baolin Wang wrote:
> Currently, the file pages already support large folio, and supporting for
> anonymous pages is also under discussion[1]. Moreover, the numa balancing
> code are converted to use a folio by previous thread[2], and the migrate_pages
> function also already supports the large folio migration.
>
> So now I did not see any reason to continue restricting NUMA balancing for
> large folio.
>
> [1] https://lkml.org/lkml/2023/9/29/342
> [2] https://lore.kernel.org/all/20230921074417.24004-4-wangkefeng.wang@huawei.com/T/#md9d10fe34587229a72801f0d731f7457ab3f4a6e
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
I'll note that another piece is missing, and I'd be curious how you
tested your patch set or what I am missing. (no anonymous pages?)
change_pte_range() contains:
if (prot_numa) {
...
/* Also skip shared copy-on-write pages */
if (is_cow_mapping(vma->vm_flags) &&
folio_ref_count(folio) != 1)
continue;
So we'll never end up mapping an anon PTE-mapped THP prot-none (well, unless a
single PTE remains) and consequently never trigger NUMA hinting faults.
Now, that change has some history [1], but the original problem has been
sorted out in the meantime. But we should consider Linus' original feedback.
For pte-mapped THP, we might want to do something like the following
(completely untested):
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 81991102f785..c4e6b9032e40 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -129,7 +129,8 @@ static long change_pte_range(struct mmu_gather *tlb,
/* Also skip shared copy-on-write pages */
if (is_cow_mapping(vma->vm_flags) &&
- folio_ref_count(folio) != 1)
+ (folio_maybe_dma_pinned(folio) ||
+ folio_estimated_sharers(folio) != 1))
continue;
Another note about the possible imprecision that might or might not
be tolerable ;)
[1] https://bugzilla.kernel.org/show_bug.cgi?id=215616
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-11-15 10:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-13 10:45 Baolin Wang
2023-11-13 10:53 ` David Hildenbrand
2023-11-13 12:10 ` Kefeng Wang
2023-11-13 13:01 ` Baolin Wang
2023-11-13 22:15 ` John Hubbard
2023-11-14 11:35 ` David Hildenbrand
2023-11-14 13:12 ` Kefeng Wang
2023-11-13 12:59 ` Baolin Wang
2023-11-13 14:49 ` David Hildenbrand
2023-11-14 10:53 ` Baolin Wang
2023-11-14 1:12 ` Huang, Ying
2023-11-14 11:11 ` Baolin Wang
2023-11-15 2:58 ` Huang, Ying
2023-11-17 10:07 ` Mel Gorman
2023-11-17 10:13 ` Peter Zijlstra
2023-11-17 16:04 ` Mel Gorman
2023-11-20 8:01 ` Baolin Wang
2023-11-15 10:46 ` David Hildenbrand [this message]
2023-11-15 10:47 ` David Hildenbrand
2023-11-20 3:28 ` Baolin Wang
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=05dbc7b8-2e4a-4762-a6a6-278985d89928@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=wangkefeng.wang@huawei.com \
--cc=willy@infradead.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