Date: Wed, 20 Feb 2019 22:32:29 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r344390 - head/sys/kern Message-ID: <201902202232.x1KMWTuD051794@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Wed Feb 20 22:32:28 2019 New Revision: 344390 URL: https://svnweb.freebsd.org/changeset/base/344390 Log: Call pmap_qenter for each page when creating the kcov buffer. This removes the need to allocate a buffer to hold the vm_page_t objects at the cost of extra IPIs on some architectures. Reviewed by: kib Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D19252 Modified: head/sys/kern/kern_kcov.c Modified: head/sys/kern/kern_kcov.c ============================================================================== --- head/sys/kern/kern_kcov.c Wed Feb 20 22:05:44 2019 (r344389) +++ head/sys/kern/kern_kcov.c Wed Feb 20 22:32:28 2019 (r344390) @@ -357,7 +357,7 @@ static int kcov_alloc(struct kcov_info *info, size_t entries) { size_t n, pages; - vm_page_t *m; + vm_page_t m; KASSERT(info->kvaddr == 0, ("kcov_alloc: Already have a buffer")); KASSERT(info->state == KCOV_STATE_OPEN, @@ -376,16 +376,14 @@ kcov_alloc(struct kcov_info *info, size_t entries) info->bufobj = vm_pager_allocate(OBJT_PHYS, 0, info->bufsize, PROT_READ | PROT_WRITE, 0, curthread->td_ucred); - m = malloc(sizeof(*m) * pages, M_TEMP, M_WAITOK); VM_OBJECT_WLOCK(info->bufobj); for (n = 0; n < pages; n++) { - m[n] = vm_page_grab(info->bufobj, n, + m = vm_page_grab(info->bufobj, n, VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_WIRED); - m[n]->valid = VM_PAGE_BITS_ALL; + m->valid = VM_PAGE_BITS_ALL; + pmap_qenter(info->kvaddr + n * PAGE_SIZE, &m, 1); } VM_OBJECT_WUNLOCK(info->bufobj); - pmap_qenter(info->kvaddr, m, pages); - free(m, M_TEMP); info->entries = entries;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201902202232.x1KMWTuD051794>