@@ -1283,7 +1283,6 @@ const struct file_operations proc_pagemap_operations = {
1283
1283
#ifdef CONFIG_NUMA
1284
1284
1285
1285
struct numa_maps {
1286
- struct vm_area_struct * vma ;
1287
1286
unsigned long pages ;
1288
1287
unsigned long anon ;
1289
1288
unsigned long active ;
@@ -1352,18 +1351,17 @@ static struct page *can_gather_numa_stats(pte_t pte, struct vm_area_struct *vma,
1352
1351
static int gather_pte_stats (pmd_t * pmd , unsigned long addr ,
1353
1352
unsigned long end , struct mm_walk * walk )
1354
1353
{
1355
- struct numa_maps * md ;
1354
+ struct numa_maps * md = walk -> private ;
1355
+ struct vm_area_struct * vma = walk -> vma ;
1356
1356
spinlock_t * ptl ;
1357
1357
pte_t * orig_pte ;
1358
1358
pte_t * pte ;
1359
1359
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 ) {
1363
1361
pte_t huge_pte = * (pte_t * )pmd ;
1364
1362
struct page * page ;
1365
1363
1366
- page = can_gather_numa_stats (huge_pte , md -> vma , addr );
1364
+ page = can_gather_numa_stats (huge_pte , vma , addr );
1367
1365
if (page )
1368
1366
gather_stats (page , md , pte_dirty (huge_pte ),
1369
1367
HPAGE_PMD_SIZE /PAGE_SIZE );
@@ -1375,7 +1373,7 @@ static int gather_pte_stats(pmd_t *pmd, unsigned long addr,
1375
1373
return 0 ;
1376
1374
orig_pte = pte = pte_offset_map_lock (walk -> mm , pmd , addr , & ptl );
1377
1375
do {
1378
- struct page * page = can_gather_numa_stats (* pte , md -> vma , addr );
1376
+ struct page * page = can_gather_numa_stats (* pte , vma , addr );
1379
1377
if (!page )
1380
1378
continue ;
1381
1379
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)
1422
1420
struct numa_maps * md = & numa_priv -> md ;
1423
1421
struct file * file = vma -> vm_file ;
1424
1422
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
+ };
1426
1429
struct mempolicy * pol ;
1427
1430
char buffer [64 ];
1428
1431
int nid ;
@@ -1433,13 +1436,6 @@ static int show_numa_map(struct seq_file *m, void *v, int is_pid)
1433
1436
/* Ensure we start with an empty set of numa_maps statistics. */
1434
1437
memset (md , 0 , sizeof (* md ));
1435
1438
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
-
1443
1439
pol = __get_vma_policy (vma , vma -> vm_start );
1444
1440
if (pol ) {
1445
1441
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)
1473
1469
if (is_vm_hugetlb_page (vma ))
1474
1470
seq_puts (m , " huge" );
1475
1471
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 );
1477
1474
1478
1475
if (!md -> pages )
1479
1476
goto out ;
0 commit comments