Skip to content

Commit d85f4d6

Browse files
Naoya Horiguchitorvalds
authored andcommitted
numa_maps: remove numa_maps->vma
pagewalk.c can handle vma in itself, so we don't have to pass vma via walk->private. And show_numa_map() walks pages on vma basis, so using walk_page_vma() is preferable. Signed-off-by: Naoya Horiguchi <[email protected]> Acked-by: Kirill A. Shutemov <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Andrea Arcangeli <[email protected]> Cc: Cyrill Gorcunov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Pavel Emelyanov <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 632fd60 commit d85f4d6

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

fs/proc/task_mmu.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,6 @@ const struct file_operations proc_pagemap_operations = {
12831283
#ifdef CONFIG_NUMA
12841284

12851285
struct numa_maps {
1286-
struct vm_area_struct *vma;
12871286
unsigned long pages;
12881287
unsigned long anon;
12891288
unsigned long active;
@@ -1352,18 +1351,17 @@ static struct page *can_gather_numa_stats(pte_t pte, struct vm_area_struct *vma,
13521351
static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
13531352
unsigned long end, struct mm_walk *walk)
13541353
{
1355-
struct numa_maps *md;
1354+
struct numa_maps *md = walk->private;
1355+
struct vm_area_struct *vma = walk->vma;
13561356
spinlock_t *ptl;
13571357
pte_t *orig_pte;
13581358
pte_t *pte;
13591359

1360-
md = walk->private;
1361-
1362-
if (pmd_trans_huge_lock(pmd, md->vma, &ptl) == 1) {
1360+
if (pmd_trans_huge_lock(pmd, vma, &ptl) == 1) {
13631361
pte_t huge_pte = *(pte_t *)pmd;
13641362
struct page *page;
13651363

1366-
page = can_gather_numa_stats(huge_pte, md->vma, addr);
1364+
page = can_gather_numa_stats(huge_pte, vma, addr);
13671365
if (page)
13681366
gather_stats(page, md, pte_dirty(huge_pte),
13691367
HPAGE_PMD_SIZE/PAGE_SIZE);
@@ -1375,7 +1373,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
13751373
return 0;
13761374
orig_pte = pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl);
13771375
do {
1378-
struct page *page = can_gather_numa_stats(*pte, md->vma, addr);
1376+
struct page *page = can_gather_numa_stats(*pte, vma, addr);
13791377
if (!page)
13801378
continue;
13811379
gather_stats(page, md, pte_dirty(*pte), 1);
@@ -1422,7 +1420,12 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
14221420
struct numa_maps *md = &numa_priv->md;
14231421
struct file *file = vma->vm_file;
14241422
struct mm_struct *mm = vma->vm_mm;
1425-
struct mm_walk walk = {};
1423+
struct mm_walk walk = {
1424+
.hugetlb_entry = gather_hugetlb_stats,
1425+
.pmd_entry = gather_pte_stats,
1426+
.private = md,
1427+
.mm = mm,
1428+
};
14261429
struct mempolicy *pol;
14271430
char buffer[64];
14281431
int nid;
@@ -1433,13 +1436,6 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
14331436
/* Ensure we start with an empty set of numa_maps statistics. */
14341437
memset(md, 0, sizeof(*md));
14351438

1436-
md->vma = vma;
1437-
1438-
walk.hugetlb_entry = gather_hugetlb_stats;
1439-
walk.pmd_entry = gather_pte_stats;
1440-
walk.private = md;
1441-
walk.mm = mm;
1442-
14431439
pol = __get_vma_policy(vma, vma->vm_start);
14441440
if (pol) {
14451441
mpol_to_str(buffer, sizeof(buffer), pol);
@@ -1473,7 +1469,8 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
14731469
if (is_vm_hugetlb_page(vma))
14741470
seq_puts(m, " huge");
14751471

1476-
walk_page_range(vma->vm_start, vma->vm_end, &walk);
1472+
/* mmap_sem is held by m_start */
1473+
walk_page_vma(vma, &walk);
14771474

14781475
if (!md->pages)
14791476
goto out;

0 commit comments

Comments
 (0)