[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240704043132.28501-21-osalvador@suse.de>
Date: Thu, 4 Jul 2024 06:31:07 +0200
From: Oscar Salvador <osalvador@...e.de>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
Peter Xu <peterx@...hat.com>,
Muchun Song <muchun.song@...ux.dev>,
David Hildenbrand <david@...hat.com>,
SeongJae Park <sj@...nel.org>,
Miaohe Lin <linmiaohe@...wei.com>,
Michal Hocko <mhocko@...e.com>,
Matthew Wilcox <willy@...radead.org>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Oscar Salvador <osalvador@...e.de>
Subject: [PATCH 20/45] fs/proc: Enable gather_pte_stats to handle cont-pte mapped hugetlb vmas
HugeTLB pages can be cont-pte mapped, so teach smaps_pte_entry to handle
them.
Signed-off-by: Oscar Salvador <osalvador@...e.de>
---
fs/proc/task_mmu.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index e13754d3246e..98dd03c26e68 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -3175,6 +3175,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
spinlock_t *ptl;
pte_t *orig_pte;
pte_t *pte;
+ unsigned long size = PAGE_SIZE, cont_ptes = 1;
#ifdef CONFIG_PGTABLE_HAS_HUGE_LEAVES
ptl = pmd_huge_lock(pmd, vma);
@@ -3200,6 +3201,10 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
walk->action = ACTION_AGAIN;
return 0;
}
+ if (pte_cont(ptep_get(pte))) {
+ size = PAGE_SIZE * CONT_PTES;
+ cont_ptes = CONT_PTES;
+ }
do {
pte_t ptent = ptep_get(pte);
struct page *page = can_gather_numa_stats(ptent, vma, addr);
@@ -3207,7 +3212,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
continue;
gather_stats(page, md, pte_dirty(ptent), 1);
- } while (pte++, addr += PAGE_SIZE, addr != end);
+ } while (pte += cont_ptes, addr += size, addr != end);
pte_unmap_unlock(orig_pte, ptl);
cond_resched();
return 0;
--
2.26.2
Powered by blists - more mailing lists