[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210518200801.7413-8-shy828301@gmail.com>
Date: Tue, 18 May 2021 13:08:01 -0700
From: Yang Shi <shy828301@...il.com>
To: mgorman@...e.de, kirill.shutemov@...ux.intel.com, ziy@...dia.com,
ying.huang@...el.com, mhocko@...e.com, hughd@...gle.com,
gerald.schaefer@...ux.ibm.com, hca@...ux.ibm.com,
gor@...ux.ibm.com, borntraeger@...ibm.com,
akpm@...ux-foundation.org
Cc: shy828301@...il.com, linux-mm@...ck.org,
linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [v3 PATCH 7/7] mm: thp: skip make PMD PROT_NONE if THP migration is not supported
A quick grep shows x86_64, PowerPC (book3s), ARM64 and S390 support both
NUMA balancing and THP. But S390 doesn't support THP migration so NUMA
balancing actually can't migrate any misplaced pages.
Skip make PMD PROT_NONE for such case otherwise CPU cycles may be wasted
by pointless NUMA hinting faults on S390.
Acked-by: Mel Gorman <mgorman@...e.de>
Signed-off-by: Yang Shi <shy828301@...il.com>
---
mm/huge_memory.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index b8526b9b041a..fb984ef5a761 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -1735,6 +1735,7 @@ bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
* Returns
* - 0 if PMD could not be locked
* - 1 if PMD was locked but protections unchanged and TLB flush unnecessary
+ * or if prot_numa but THP migration is not supported
* - HPAGE_PMD_NR if protections changed and TLB flush necessary
*/
int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
@@ -1749,6 +1750,9 @@ int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
bool uffd_wp = cp_flags & MM_CP_UFFD_WP;
bool uffd_wp_resolve = cp_flags & MM_CP_UFFD_WP_RESOLVE;
+ if (prot_numa && !thp_migration_supported())
+ return 1;
+
ptl = __pmd_trans_huge_lock(pmd, vma);
if (!ptl)
return 0;
--
2.26.2
Powered by blists - more mailing lists