Date: Sun, 29 Jan 2006 06:19:06 GMT From: Alan Cox <alc@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 90603 for review Message-ID: <200601290619.k0T6J6K2029304@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=90603 Change 90603 by alc@alc_home on 2006/01/29 06:18:23 Revise buddy_unfree(). Affected files ... .. //depot/projects/superpages/src/sys/vm/vm_buddy.c#5 edit .. //depot/projects/superpages/src/sys/vm/vm_buddy.h#5 edit .. //depot/projects/superpages/src/sys/vm/vm_pageq.c#13 edit Differences ... ==== //depot/projects/superpages/src/sys/vm/vm_buddy.c#5 (text+ko) ==== @@ -255,26 +255,22 @@ /* * Extract the give page from the buddy queues. */ -boolean_t +void buddy_unfree(vm_page_t m) { vm_paddr_t half; vm_page_t buddy, other; int q; + mtx_assert(&vm_page_queue_mtx, MA_OWNED); KASSERT(m->flags & PG_CACHE, ("xxx")); buddy = m; - mtx_lock_spin(&vm_page_queue_free_mtx); - for (q = 0; (buddy->queue - buddy->buddyq) != PQ_BUDDY && + for (q = 0; !VM_PAGE_INQUEUE1(buddy, PQ_CACHE) && q < BUDDY_QUEUES; q++) { buddy = PHYS_TO_VM_PAGE(m->phys_addr & (~(vm_paddr_t)0 << (PAGE_SHIFT + q))); } - if (q == BUDDY_QUEUES || buddy->buddyq < q) { - mtx_unlock_spin(&vm_page_queue_free_mtx); - return (FALSE); - } - q = buddy->buddyq; + KASSERT(q == buddy->buddyq, ("xxx")); /* * m is in the free list as part of a chunk of size 1<<q whose @@ -287,17 +283,16 @@ q--; half = buddy->phys_addr ^ (1 << (PAGE_SHIFT + q)); if (m->phys_addr < half) - other = PHYS_TO_VM_PAGE(half); + other = phys_to_vm_page(half); else { other = buddy; - buddy = PHYS_TO_VM_PAGE(half); + buddy = phys_to_vm_page(half); } buddy_insert(q, other); } - cnt.v_free_count--; - mtx_unlock_spin(&vm_page_queue_free_mtx); + cnt.v_cache_count--; KASSERT(buddy == m, ("yyy")); - return (TRUE); + KASSERT(m->queue == PQ_NONE, ("xxx")); } /* ==== //depot/projects/superpages/src/sys/vm/vm_buddy.h#5 (text+ko) ==== @@ -6,4 +6,4 @@ vm_page_t buddy_alloc_locked(int magn, boolean_t prefer_zero); void buddy_free(vm_page_t m, int magn); void buddy_free_locked(vm_page_t m, int magn); -boolean_t buddy_unfree(vm_page_t m); +void buddy_unfree(vm_page_t m); ==== //depot/projects/superpages/src/sys/vm/vm_pageq.c#13 (text+ko) ==== @@ -166,7 +166,6 @@ if ((m->flags & PG_CACHE) != 0) { buddy_unfree(m); - KASSERT(m->queue == PQ_NONE, ("xxx")); vm_page_flag_clear(m, PG_CACHE); } else if (queue != PQ_NONE) { pq = &vm_page_queues[queue]; @@ -193,7 +192,6 @@ if ((m->flags & PG_CACHE) != 0) { buddy_unfree(m); - KASSERT(m->queue == PQ_NONE, ("xxx")); vm_page_flag_clear(m, PG_CACHE); if (vm_paging_needed()) pagedaemon_wakeup();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601290619.k0T6J6K2029304>