Commit 405e6691 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton
Browse files

powerpc: remove mmap linked list walks

Use the VMA iterator instead.

Link: https://lkml.kernel.org/r/20220906194824.2110408-34-Liam.Howlett@oracle.com


Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarLiam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: default avatarVlastimil Babka <vbabka@suse.cz>
Reviewed-by: default avatarDavidlohr Bueso <dave@stgolabs.net>
Tested-by: default avatarYu Zhao <yuzhao@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 70fa2031
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -113,18 +113,18 @@ struct vdso_data *arch_get_vdso_data(void *vvar_page)
int vdso_join_timens(struct task_struct *task, struct time_namespace *ns)
int vdso_join_timens(struct task_struct *task, struct time_namespace *ns)
{
{
	struct mm_struct *mm = task->mm;
	struct mm_struct *mm = task->mm;
	VMA_ITERATOR(vmi, mm, 0);
	struct vm_area_struct *vma;
	struct vm_area_struct *vma;


	mmap_read_lock(mm);
	mmap_read_lock(mm);

	for_each_vma(vmi, vma) {
	for (vma = mm->mmap; vma; vma = vma->vm_next) {
		unsigned long size = vma->vm_end - vma->vm_start;
		unsigned long size = vma->vm_end - vma->vm_start;


		if (vma_is_special_mapping(vma, &vvar_spec))
		if (vma_is_special_mapping(vma, &vvar_spec))
			zap_page_range(vma, vma->vm_start, size);
			zap_page_range(vma, vma->vm_start, size);
	}
	}

	mmap_read_unlock(mm);
	mmap_read_unlock(mm);

	return 0;
	return 0;
}
}


+6 −5
Original line number Original line Diff line number Diff line
@@ -81,14 +81,15 @@ EXPORT_SYMBOL(hash__flush_range);
void hash__flush_tlb_mm(struct mm_struct *mm)
void hash__flush_tlb_mm(struct mm_struct *mm)
{
{
	struct vm_area_struct *mp;
	struct vm_area_struct *mp;
	VMA_ITERATOR(vmi, mm, 0);


	/*
	/*
	 * It is safe to go down the mm's list of vmas when called
	 * It is safe to iterate the vmas when called from dup_mmap,
	 * from dup_mmap, holding mmap_lock.  It would also be safe from
	 * holding mmap_lock.  It would also be safe from unmap_region
	 * unmap_region or exit_mmap, but not from vmtruncate on SMP -
	 * or exit_mmap, but not from vmtruncate on SMP - but it seems
	 * but it seems dup_mmap is the only SMP case which gets here.
	 * dup_mmap is the only SMP case which gets here.
	 */
	 */
	for (mp = mm->mmap; mp != NULL; mp = mp->vm_next)
	for_each_vma(vmi, mp)
		hash__flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
		hash__flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
}
}
EXPORT_SYMBOL(hash__flush_tlb_mm);
EXPORT_SYMBOL(hash__flush_tlb_mm);
+2 −11
Original line number Original line Diff line number Diff line
@@ -149,24 +149,15 @@ static void subpage_mark_vma_nohuge(struct mm_struct *mm, unsigned long addr,
				    unsigned long len)
				    unsigned long len)
{
{
	struct vm_area_struct *vma;
	struct vm_area_struct *vma;
	VMA_ITERATOR(vmi, mm, addr);


	/*
	/*
	 * We don't try too hard, we just mark all the vma in that range
	 * We don't try too hard, we just mark all the vma in that range
	 * VM_NOHUGEPAGE and split them.
	 * VM_NOHUGEPAGE and split them.
	 */
	 */
	vma = find_vma(mm, addr);
	for_each_vma_range(vmi, vma, addr + len) {
	/*
	 * If the range is in unmapped range, just return
	 */
	if (vma && ((addr + len) <= vma->vm_start))
		return;

	while (vma) {
		if (vma->vm_start >= (addr + len))
			break;
		vma->vm_flags |= VM_NOHUGEPAGE;
		vma->vm_flags |= VM_NOHUGEPAGE;
		walk_page_vma(vma, &subpage_walk_ops, NULL);
		walk_page_vma(vma, &subpage_walk_ops, NULL);
		vma = vma->vm_next;
	}
	}
}
}
#else
#else