Date: Wed, 25 Jan 2006 02:28:53 GMT From: Olivier Houchard <cognet@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 90319 for review Message-ID: <200601250228.k0P2Srjv089870@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=90319 Change 90319 by cognet@cognet on 2006/01/25 02:27:55 Fix merge. Affected files ... .. //depot/projects/superpages/src/sys/vm/vm_page.c#10 edit .. //depot/projects/superpages/src/sys/vm/vm_page.h#4 edit .. //depot/projects/superpages/src/sys/vm/vm_pageout.c#4 edit .. //depot/projects/superpages/src/sys/vm/vm_pageq.c#5 edit Differences ... ==== //depot/projects/superpages/src/sys/vm/vm_page.c#10 (text+ko) ==== @@ -390,7 +390,7 @@ mtx_assert(&vm_page_queue_mtx, MA_OWNED); --mem->hold_count; KASSERT(mem->hold_count >= 0, ("vm_page_unhold: hold count < 0!!!")); - if (mem->hold_count == 0 && VM_PAGE_INQUEUE2(mem, PQ_HOLD)) + if (mem->hold_count == 0 && mem->queue == PQ_HOLD) vm_page_free_toq(mem); } @@ -1230,7 +1230,7 @@ /* * Ignore if already inactive. */ - if (VM_PAGE_INQUEUE2(m, PQ_INACTIVE)) + if (m->queue == PQ_INACTIVE) return; if (m->wire_count == 0 && (m->flags & PG_UNMANAGED) == 0) { if (m->queue == PQ_CACHE) @@ -1241,7 +1241,7 @@ TAILQ_INSERT_HEAD(&vm_page_queues[PQ_INACTIVE].pl, m, pageq); else TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m, pageq); - VM_PAGE_SETQUEUE2(m, PQ_INACTIVE); + m->queue = PQ_INACTIVE; vm_page_queues[PQ_INACTIVE].lcnt++; cnt.v_inactive_count++; } ==== //depot/projects/superpages/src/sys/vm/vm_page.h#4 (text+ko) ==== @@ -159,22 +159,10 @@ int lcnt; }; -struct pq_coloring { - int numcolors; - int colormask; - int prime1; - int prime2; - int inactive; - int active; - int cache; - int hold; - int count; - int maxlength; -}; +extern struct vpgqueues vm_page_queues[PQ_COUNT]; +extern struct mtx vm_page_queue_free_mtx; -extern struct vpgqueues vm_page_queues[PQ_MAXCOUNT]; -extern struct mtx vm_page_queue_free_mtx; -extern struct pq_coloring page_queue_coloring; +#endif /* * These are the flags defined for vm_page. ==== //depot/projects/superpages/src/sys/vm/vm_pageout.c#4 (text+ko) ==== @@ -740,7 +740,7 @@ cnt.v_pdpages++; - if (VM_PAGE_GETQUEUE(m) != PQ_INACTIVE) { + if (m->queue != PQ_INACTIVE) { goto rescan0; } @@ -956,7 +956,7 @@ * reused for another vnode. The object might * have been reused for another vnode. */ - if (VM_PAGE_GETQUEUE(m) != PQ_INACTIVE || + if (m->queue != PQ_INACTIVE || m->object != object || object->handle != vp) { if (object->flags & OBJ_MIGHTBEDIRTY) ==== //depot/projects/superpages/src/sys/vm/vm_pageq.c#5 (text+ko) ==== @@ -52,89 +52,8 @@ #include <vm/vm_buddy.h> -static void vm_coloring_init(void); -void setPQL2(int *const size, int *const ways); - -struct vpgqueues vm_page_queues[PQ_MAXCOUNT]; -struct pq_coloring page_queue_coloring; - -static int pq_cachesize = 0; /* size of the cache in KB */ -static int pq_cachenways = 0; /* associativity of the cache */ - -SYSCTL_DECL(_vm_stats); -SYSCTL_NODE(_vm_stats, OID_AUTO, pagequeue, CTLFLAG_RW, 0, "VM meter stats"); -SYSCTL_INT(_vm_stats_pagequeue, OID_AUTO, page_colors, CTLFLAG_RD, - &(PQ_NUMCOLORS), 0, "Number of colors in the page queue"); -SYSCTL_INT(_vm_stats_pagequeue, OID_AUTO, cachesize, CTLFLAG_RD, - &pq_cachesize, 0, "Size of the processor cache in KB"); -SYSCTL_INT(_vm_stats_pagequeue, OID_AUTO, cachenways, CTLFLAG_RD, - &pq_cachenways, 0, "Associativity of the processor cache"); -SYSCTL_INT(_vm_stats_pagequeue, OID_AUTO, prime1, CTLFLAG_RD, - &(PQ_PRIME1), 0, "Cache tuning value"); -SYSCTL_INT(_vm_stats_pagequeue, OID_AUTO, prime2, CTLFLAG_RD, - &(PQ_PRIME2), 0, "Cache tuning value"); - -static void -vm_coloring_init(void) -{ -#ifdef PQ_NOOPT - PQ_NUMCOLORS = PQ_PRIME1 = PQ_PRIME2 = 1; -#else - - setPQL2(&pq_cachesize, &pq_cachenways); - - CTASSERT(PAGE_SIZE/1024 > 0); - - if (pq_cachesize > 0 && pq_cachenways > 0) - PQ_NUMCOLORS = pq_cachesize / (PAGE_SIZE/1024) / \ - pq_cachenways; - else - PQ_NUMCOLORS = 32; - - if (PQ_MAXCOLORS < PQ_NUMCOLORS) { - printf("VM-PQ color limit (PQ_MAXCOLORS=%u) exceeded (%u), see vm_page.h", PQ_MAXCOLORS, PQ_NUMCOLORS); - PQ_NUMCOLORS = PQ_MAXCOLORS; - } +struct vpgqueues vm_page_queues[PQ_COUNT]; - if (PQ_NUMCOLORS >= 128) { - PQ_PRIME1 = 31; - PQ_PRIME2 = 23; - } else if (PQ_NUMCOLORS >= 64) { - PQ_PRIME1 = 13; - PQ_PRIME2 = 7; - } else if (PQ_NUMCOLORS >= 32) { - PQ_PRIME1 = 9; - PQ_PRIME2 = 5; - } else if (PQ_NUMCOLORS >= 16) { - PQ_PRIME1 = 5; - PQ_PRIME2 = 3; - } else - PQ_NUMCOLORS = PQ_PRIME1 = PQ_PRIME2 = 1; -#endif - - /* - * PQ_CACHE represents a - * PQ_NUMCOLORS consecutive queue. - */ - PQ_COLORMASK = PQ_NUMCOLORS - 1; - PQ_INACTIVE = 1 + PQ_NUMCOLORS; - PQ_ACTIVE = 2 + PQ_NUMCOLORS; - PQ_CACHE = 3 + PQ_NUMCOLORS; - PQ_HOLD = 3 + 2 * PQ_NUMCOLORS; - PQ_COUNT = 4 + 2 * PQ_NUMCOLORS; - PQ_MAXLENGTH = PQ_NUMCOLORS / 3 + PQ_PRIME1; - -#if 0 - /* XXX: is it possible to allocate vm_page_queues[PQ_COUNT] here? */ -#error XXX: vm_page_queues = malloc(PQ_COUNT * sizeof(struct vpgqueues)); -#endif - - if (bootverbose) - if (PQ_NUMCOLORS > 1) - printf("Using %d colors for the VM-PQ tuning (%d, %d)\n", - PQ_NUMCOLORS, pq_cachesize, pq_cachenways); -} - void vm_pageq_init(void) { @@ -156,7 +75,7 @@ void vm_pageq_requeue(vm_page_t m) { - int queue = VM_PAGE_GETQUEUE(m); + int queue = m->queue; struct vpgqueues *vpq; if (queue != PQ_NONE) { @@ -176,7 +95,7 @@ struct vpgqueues *vpq; vpq = &vm_page_queues[queue]; - VM_PAGE_SETQUEUE2(m, queue); + m->queue = queue; TAILQ_INSERT_TAIL(&vpq->pl, m, pageq); ++*vpq->cnt; ++vpq->lcnt; @@ -244,12 +163,12 @@ void vm_pageq_remove_nowakeup(vm_page_t m) { - int queue = VM_PAGE_GETQUEUE(m); + int queue = m->queue; struct vpgqueues *pq; if (queue != PQ_NONE) { pq = &vm_page_queues[queue]; - VM_PAGE_SETQUEUE2(m, PQ_NONE); + m->queue = PQ_NONE; TAILQ_REMOVE(&pq->pl, m, pageq); (*pq->cnt)--; pq->lcnt--; @@ -267,11 +186,11 @@ void vm_pageq_remove(vm_page_t m) { - int queue = VM_PAGE_GETQUEUE(m); + int queue = m->queue; struct vpgqueues *pq; if (queue != PQ_NONE) { - VM_PAGE_SETQUEUE2(m, PQ_NONE); + m->queue = PQ_NONE; pq = &vm_page_queues[queue]; KASSERT((m->queue - m->buddyq) != PQ_BUDDY,("vm_pageq_remove: page is un buddy allocator")); TAILQ_REMOVE(&pq->pl, m, pageq);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200601250228.k0P2Srjv089870>