Re: git: 4568f5a286a2 - main - kern_kcov: replace vm_page_next() with iterator
- In reply to: Doug Moore : "git: 4568f5a286a2 - main - kern_kcov: replace vm_page_next() with iterator"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Apr 2025 17:30:55 UTC
An unfortunate copy/paste error. Make that
Differential Revision:https://reviews.freebsd.org/D49889
On 4/18/25 12:24, Doug Moore wrote:
> The branch main has been updated by dougm:
>
> URL:https://cgit.FreeBSD.org/src/commit/?id=4568f5a286a212fcceaf9a9bb90eabc104829f49
>
> commit 4568f5a286a212fcceaf9a9bb90eabc104829f49
> Author: Doug Moore<dougm@FreeBSD.org>
> AuthorDate: 2025-04-18 17:18:00 +0000
> Commit: Doug Moore<dougm@FreeBSD.org>
> CommitDate: 2025-04-18 17:24:04 +0000
>
> kern_kcov: replace vm_page_next() with iterator
>
> Use VM_RADIX_FORALL, and drop a use of vm_page_next(), in kcov_free().
>
> Reviewed by: kib
> Differential Revision: kern_kcov: replace vm_page_next() with iterator
> ---
> sys/kern/kern_kcov.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/sys/kern/kern_kcov.c b/sys/kern/kern_kcov.c
> index 19d35a1ad961..1c1d924b8b79 100644
> --- a/sys/kern/kern_kcov.c
> +++ b/sys/kern/kern_kcov.c
> @@ -396,20 +396,19 @@ kcov_alloc(struct kcov_info *info, size_t entries)
> static void
> kcov_free(struct kcov_info *info)
> {
> + struct pctrie_iter pages;
> vm_page_t m;
> - size_t i;
>
> if (info->kvaddr != 0) {
> pmap_qremove(info->kvaddr, info->bufsize / PAGE_SIZE);
> kva_free(info->kvaddr, info->bufsize);
> }
> if (info->bufobj != NULL) {
> + vm_page_iter_limit_init(&pages, info->bufobj,
> + info->bufsize / PAGE_SIZE);
> VM_OBJECT_WLOCK(info->bufobj);
> - m = vm_page_lookup(info->bufobj, 0);
> - for (i = 0; i < info->bufsize / PAGE_SIZE; i++) {
> + VM_RADIX_FORALL(m, &pages)
> vm_page_unwire_noq(m);
> - m = vm_page_next(m);
> - }
> VM_OBJECT_WUNLOCK(info->bufobj);
> vm_object_deallocate(info->bufobj);
> }