From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: akpm@linux-foundation.org, songmuchun@bytedance.com,
mike.kravetz@oracle.com
Cc: baolin.wang@linux.alibaba.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] mm/hugetlb: add FOLL_MIGRATION validation before waiting for a migration entry
Date: Fri, 19 Aug 2022 18:12:58 +0800 [thread overview]
Message-ID: <0ec5d75781452af85e6226e1b5940ff557c6f5e7.1660902741.git.baolin.wang@linux.alibaba.com> (raw)
In-Reply-To: <cover.1660902741.git.baolin.wang@linux.alibaba.com>
In-Reply-To: <cover.1660902741.git.baolin.wang@linux.alibaba.com>
The hugetlb should keep the same logics with normal page when waiting
for a migration pte entry, that means we should also validate if
the FOLL_MIGRATION flag is set before waiting for a migration pte entry
of a hugetlb page.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
mm/hugetlb.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index efb53ba..fac1b33 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -7000,6 +7000,11 @@ struct page * __weak
goto out;
}
} else {
+ if (!(flags & FOLL_MIGRATION)) {
+ page = NULL;
+ goto out;
+ }
+
if (is_hugetlb_entry_migration(pte)) {
spin_unlock(ptl);
__migration_entry_wait_huge((pte_t *)pmd, ptl);
@@ -7038,6 +7043,11 @@ struct page * __weak
goto out;
}
} else {
+ if (!(flags & FOLL_MIGRATION)) {
+ page = NULL;
+ goto out;
+ }
+
if (is_hugetlb_entry_migration(pte)) {
spin_unlock(ptl);
__migration_entry_wait(mm, (pte_t *)pud, ptl);
--
1.8.3.1
next prev parent reply other threads:[~2022-08-19 10:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-19 10:12 [PATCH 0/3] Fix some issues when looking up hugetlb page Baolin Wang
2022-08-19 10:12 ` [PATCH 1/3] mm/gup: fix races when looking up a CONT-PTE size " Baolin Wang
2022-08-19 16:34 ` kernel test robot
2022-08-19 17:46 ` kernel test robot
2022-08-19 10:12 ` [PATCH 2/3] mm/hugetlb: fix races when looking up a CONT-PMD " Baolin Wang
2022-08-19 10:12 ` Baolin Wang [this message]
2022-08-20 0:08 ` [PATCH 0/3] Fix some issues when looking up " Mike Kravetz
2022-08-21 5:54 ` 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=0ec5d75781452af85e6226e1b5940ff557c6f5e7.1660902741.git.baolin.wang@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=songmuchun@bytedance.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