git: a23e6a1078d6 - main - vm_page: Move vm_page_alloc_check() to after page allocator definitions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 20 Oct 2021 01:23:14 UTC
The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=a23e6a1078d6d6c361481ab4f835449f177edac3 commit a23e6a1078d6d6c361481ab4f835449f177edac3 Author: Mark Johnston <markj@FreeBSD.org> AuthorDate: 2021-10-20 01:22:50 +0000 Commit: Mark Johnston <markj@FreeBSD.org> CommitDate: 2021-10-20 01:22:50 +0000 vm_page: Move vm_page_alloc_check() to after page allocator definitions This way all of the vm_page_alloc_*() allocator functions are grouped together. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/vm/vm_page.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 25e6dce32aa6..bc1c6bbe4ce1 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2394,28 +2394,6 @@ found: return (m_ret); } -/* - * Check a page that has been freshly dequeued from a freelist. - */ -static void -vm_page_alloc_check(vm_page_t m) -{ - - KASSERT(m->object == NULL, ("page %p has object", m)); - KASSERT(m->a.queue == PQ_NONE && - (m->a.flags & PGA_QUEUE_STATE_MASK) == 0, - ("page %p has unexpected queue %d, flags %#x", - m, m->a.queue, (m->a.flags & PGA_QUEUE_STATE_MASK))); - KASSERT(m->ref_count == 0, ("page %p has references", m)); - KASSERT(vm_page_busy_freed(m), ("page %p is not freed", m)); - KASSERT(m->dirty == 0, ("page %p is dirty", m)); - KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, - ("page %p has unexpected memattr %d", - m, pmap_page_get_memattr(m))); - KASSERT(m->valid == 0, ("free page %p is valid", m)); - pmap_vm_page_alloc_check(m); -} - /* * vm_page_alloc_freelist: * @@ -2494,6 +2472,27 @@ again: return (m); } +/* + * Check a page that has been freshly dequeued from a freelist. + */ +static void +vm_page_alloc_check(vm_page_t m) +{ + KASSERT(m->object == NULL, ("page %p has object", m)); + KASSERT(m->ref_count == 0, ("page %p has references", m)); + KASSERT(vm_page_busy_freed(m), ("page %p is not freed", m)); + KASSERT(m->a.queue == PQ_NONE && + (m->a.flags & PGA_QUEUE_STATE_MASK) == 0, + ("page %p has unexpected queue %d, flags %#x", + m, m->a.queue, (m->a.flags & PGA_QUEUE_STATE_MASK))); + KASSERT(m->valid == 0, ("free page %p is valid", m)); + KASSERT(m->dirty == 0, ("page %p is dirty", m)); + KASSERT(pmap_page_get_memattr(m) == VM_MEMATTR_DEFAULT, + ("page %p has unexpected memattr %d", + m, pmap_page_get_memattr(m))); + pmap_vm_page_alloc_check(m); +} + static int vm_page_zone_import(void *arg, void **store, int cnt, int domain, int flags) {