From owner-p4-projects@FreeBSD.ORG Sun Jan 29 06:19:11 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8BB3F16A423; Sun, 29 Jan 2006 06:19:10 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4C4E516A420 for ; Sun, 29 Jan 2006 06:19:10 +0000 (GMT) (envelope-from alc@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6286F43D60 for ; Sun, 29 Jan 2006 06:19:06 +0000 (GMT) (envelope-from alc@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k0T6J6ca029307 for ; Sun, 29 Jan 2006 06:19:06 GMT (envelope-from alc@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k0T6J6K2029304 for perforce@freebsd.org; Sun, 29 Jan 2006 06:19:06 GMT (envelope-from alc@freebsd.org) Date: Sun, 29 Jan 2006 06:19:06 GMT Message-Id: <200601290619.k0T6J6K2029304@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to alc@freebsd.org using -f From: Alan Cox To: Perforce Change Reviews Cc: Subject: PERFORCE change 90603 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2006 06:19:11 -0000 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<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();