[PATCH 30/45] mm,mincore: Enable mincore_pte_range to handle hugetlb vmas

From: Oscar Salvador
Date: Thu Jul 04 2024 - 00:38:28 EST


PMD-mapped hugetlb vmas will also mincore_pte_range.
Add the required code so it knows how to handle those there.

Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
---
mm/mincore.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/mincore.c b/mm/mincore.c
index d6bd19e520fc..5154bc705f60 100644
--- a/mm/mincore.c
+++ b/mm/mincore.c
@@ -18,6 +18,7 @@
#include <linux/shmem_fs.h>
#include <linux/hugetlb.h>
#include <linux/pgtable.h>
+#include <linux/mm_inline.h>

#include <linux/uaccess.h>
#include "swap.h"
@@ -106,8 +107,9 @@ static int mincore_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
unsigned char *vec = walk->private;
int nr = (end - addr) >> PAGE_SHIFT;

- ptl = pmd_trans_huge_lock(pmd, vma);
+ ptl = pmd_huge_lock(pmd, vma);
if (ptl) {
+ /* Better handling of hugetlb is required (pte marker etc.) */
memset(vec, 1, nr);
spin_unlock(ptl);
goto out;
--
2.26.2