aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-08-28 10:19:54 -0400
committerJason Gunthorpe <jgg@mellanox.com>2019-09-07 03:28:04 -0400
commit7b86ac3371b70c3fd8fd95501719beb1faab719f (patch)
treeb7f61e4615d249563f09567a22ee399634c898dd /arch/s390
parenta520110e4a15ceb385304d9cab22bb51438f6080 (diff)
pagewalk: separate function pointers from iterator data
The mm_walk structure currently mixed data and code. Split out the operations vectors into a new mm_walk_ops structure, and while we are changing the API also declare the mm_walk structure inside the walk_page_range and walk_page_vma functions. Based on patch from Linus Torvalds. Link: https://lore.kernel.org/r/20190828141955.22210-3-hch@lst.de Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Steven Price <steven.price@arm.com> Reviewed-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/mm/gmap.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
index cf80feae970d..bd78d504fdad 100644
--- a/arch/s390/mm/gmap.c
+++ b/arch/s390/mm/gmap.c
@@ -2521,13 +2521,9 @@ static int __zap_zero_pages(pmd_t *pmd, unsigned long start,
2521 return 0; 2521 return 0;
2522} 2522}
2523 2523
2524static inline void zap_zero_pages(struct mm_struct *mm) 2524static const struct mm_walk_ops zap_zero_walk_ops = {
2525{ 2525 .pmd_entry = __zap_zero_pages,
2526 struct mm_walk walk = { .pmd_entry = __zap_zero_pages }; 2526};
2527
2528 walk.mm = mm;
2529 walk_page_range(0, TASK_SIZE, &walk);
2530}
2531 2527
2532/* 2528/*
2533 * switch on pgstes for its userspace process (for kvm) 2529 * switch on pgstes for its userspace process (for kvm)
@@ -2546,7 +2542,7 @@ int s390_enable_sie(void)
2546 mm->context.has_pgste = 1; 2542 mm->context.has_pgste = 1;
2547 /* split thp mappings and disable thp for future mappings */ 2543 /* split thp mappings and disable thp for future mappings */
2548 thp_split_mm(mm); 2544 thp_split_mm(mm);
2549 zap_zero_pages(mm); 2545 walk_page_range(mm, 0, TASK_SIZE, &zap_zero_walk_ops, NULL);
2550 up_write(&mm->mmap_sem); 2546 up_write(&mm->mmap_sem);
2551 return 0; 2547 return 0;
2552} 2548}
@@ -2589,12 +2585,13 @@ static int __s390_enable_skey_hugetlb(pte_t *pte, unsigned long addr,
2589 return 0; 2585 return 0;
2590} 2586}
2591 2587
2588static const struct mm_walk_ops enable_skey_walk_ops = {
2589 .hugetlb_entry = __s390_enable_skey_hugetlb,
2590 .pte_entry = __s390_enable_skey_pte,
2591};
2592
2592int s390_enable_skey(void) 2593int s390_enable_skey(void)
2593{ 2594{
2594 struct mm_walk walk = {
2595 .hugetlb_entry = __s390_enable_skey_hugetlb,
2596 .pte_entry = __s390_enable_skey_pte,
2597 };
2598 struct mm_struct *mm = current->mm; 2595 struct mm_struct *mm = current->mm;
2599 struct vm_area_struct *vma; 2596 struct vm_area_struct *vma;
2600 int rc = 0; 2597 int rc = 0;
@@ -2614,8 +2611,7 @@ int s390_enable_skey(void)
2614 } 2611 }
2615 mm->def_flags &= ~VM_MERGEABLE; 2612 mm->def_flags &= ~VM_MERGEABLE;
2616 2613
2617 walk.mm = mm; 2614 walk_page_range(mm, 0, TASK_SIZE, &enable_skey_walk_ops, NULL);
2618 walk_page_range(0, TASK_SIZE, &walk);
2619 2615
2620out_up: 2616out_up:
2621 up_write(&mm->mmap_sem); 2617 up_write(&mm->mmap_sem);
@@ -2633,13 +2629,14 @@ static int __s390_reset_cmma(pte_t *pte, unsigned long addr,
2633 return 0; 2629 return 0;
2634} 2630}
2635 2631
2632static const struct mm_walk_ops reset_cmma_walk_ops = {
2633 .pte_entry = __s390_reset_cmma,
2634};
2635
2636void s390_reset_cmma(struct mm_struct *mm) 2636void s390_reset_cmma(struct mm_struct *mm)
2637{ 2637{
2638 struct mm_walk walk = { .pte_entry = __s390_reset_cmma };
2639
2640 down_write(&mm->mmap_sem); 2638 down_write(&mm->mmap_sem);
2641 walk.mm = mm; 2639 walk_page_range(mm, 0, TASK_SIZE, &reset_cmma_walk_ops, NULL);
2642 walk_page_range(0, TASK_SIZE, &walk);
2643 up_write(&mm->mmap_sem); 2640 up_write(&mm->mmap_sem);
2644} 2641}
2645EXPORT_SYMBOL_GPL(s390_reset_cmma); 2642EXPORT_SYMBOL_GPL(s390_reset_cmma);