git: 97f3a1565d88 - main - linuxkpi: use iterator in zap_vma_ptes
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 19 Apr 2025 22:32:53 UTC
The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=97f3a1565d88b2d9f01ac571e016184935dd6a08 commit 97f3a1565d88b2d9f01ac571e016184935dd6a08 Author: Doug Moore <dougm@FreeBSD.org> AuthorDate: 2025-04-19 22:31:29 +0000 Commit: Doug Moore <dougm@FreeBSD.org> CommitDate: 2025-04-19 22:31:29 +0000 linuxkpi: use iterator in zap_vma_ptes Change zap_vma_ptes() to use iterators, rather than TAILQ pointers. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D49918 --- sys/compat/linuxkpi/common/src/linux_compat.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 30acd1b54e9c..e061504868fd 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -59,6 +59,7 @@ #include <vm/vm_object.h> #include <vm/vm_page.h> #include <vm/vm_pager.h> +#include <vm/vm_radix.h> #include <machine/stdarg.h> @@ -647,6 +648,7 @@ int zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, unsigned long size) { + struct pctrie_iter pages; vm_object_t obj; vm_page_t m; @@ -654,9 +656,8 @@ zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, if (obj == NULL || (obj->flags & OBJ_UNMANAGED) != 0) return (-ENOTSUP); VM_OBJECT_RLOCK(obj); - for (m = vm_page_find_least(obj, OFF_TO_IDX(address)); - m != NULL && m->pindex < OFF_TO_IDX(address + size); - m = TAILQ_NEXT(m, listq)) + vm_page_iter_limit_init(&pages, obj, OFF_TO_IDX(address + size)); + VM_RADIX_FOREACH_FROM(m, &pages, OFF_TO_IDX(address)) pmap_remove_all(m); VM_OBJECT_RUNLOCK(obj); return (0);