The core of this patch is to vm/vm_page.h. The effects are two-fold: (1) to
eliminate an extra (useless) level of indirection in half of the page queue accesses and (2) to use a single name for each queue throughout, instead of, e.g., "vm_page_queue_active" in some places and "vm_page_queues[PQ_ACTIVE]" in others. Reviewed by: dillon
This commit is contained in:
parent
7c997246be
commit
17798250d5
@ -422,7 +422,7 @@ vm_page_zero_idle()
|
|||||||
zero_state = 0;
|
zero_state = 0;
|
||||||
if (m != NULL && (m->flags & PG_ZERO) == 0) {
|
if (m != NULL && (m->flags & PG_ZERO) == 0) {
|
||||||
vm_page_queues[m->queue].lcnt--;
|
vm_page_queues[m->queue].lcnt--;
|
||||||
TAILQ_REMOVE(vm_page_queues[m->queue].pl, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[m->queue].pl, m, pageq);
|
||||||
m->queue = PQ_NONE;
|
m->queue = PQ_NONE;
|
||||||
splx(s);
|
splx(s);
|
||||||
#if 0
|
#if 0
|
||||||
@ -436,7 +436,7 @@ vm_page_zero_idle()
|
|||||||
vm_page_flag_set(m, PG_ZERO);
|
vm_page_flag_set(m, PG_ZERO);
|
||||||
m->queue = PQ_FREE + m->pc;
|
m->queue = PQ_FREE + m->pc;
|
||||||
vm_page_queues[m->queue].lcnt++;
|
vm_page_queues[m->queue].lcnt++;
|
||||||
TAILQ_INSERT_TAIL(vm_page_queues[m->queue].pl, m,
|
TAILQ_INSERT_TAIL(&vm_page_queues[m->queue].pl, m,
|
||||||
pageq);
|
pageq);
|
||||||
++vm_page_zero_count;
|
++vm_page_zero_count;
|
||||||
++cnt_prezero;
|
++cnt_prezero;
|
||||||
|
@ -554,7 +554,7 @@ vm_page_zero_idle()
|
|||||||
m = vm_page_list_find(PQ_FREE, free_rover, FALSE);
|
m = vm_page_list_find(PQ_FREE, free_rover, FALSE);
|
||||||
if (m != NULL && (m->flags & PG_ZERO) == 0) {
|
if (m != NULL && (m->flags & PG_ZERO) == 0) {
|
||||||
vm_page_queues[m->queue].lcnt--;
|
vm_page_queues[m->queue].lcnt--;
|
||||||
TAILQ_REMOVE(vm_page_queues[m->queue].pl, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[m->queue].pl, m, pageq);
|
||||||
m->queue = PQ_NONE;
|
m->queue = PQ_NONE;
|
||||||
splx(s);
|
splx(s);
|
||||||
#if 0
|
#if 0
|
||||||
@ -568,7 +568,7 @@ vm_page_zero_idle()
|
|||||||
vm_page_flag_set(m, PG_ZERO);
|
vm_page_flag_set(m, PG_ZERO);
|
||||||
m->queue = PQ_FREE + m->pc;
|
m->queue = PQ_FREE + m->pc;
|
||||||
vm_page_queues[m->queue].lcnt++;
|
vm_page_queues[m->queue].lcnt++;
|
||||||
TAILQ_INSERT_TAIL(vm_page_queues[m->queue].pl, m,
|
TAILQ_INSERT_TAIL(&vm_page_queues[m->queue].pl, m,
|
||||||
pageq);
|
pageq);
|
||||||
++vm_page_zero_count;
|
++vm_page_zero_count;
|
||||||
++cnt_prezero;
|
++cnt_prezero;
|
||||||
|
@ -554,7 +554,7 @@ vm_page_zero_idle()
|
|||||||
m = vm_page_list_find(PQ_FREE, free_rover, FALSE);
|
m = vm_page_list_find(PQ_FREE, free_rover, FALSE);
|
||||||
if (m != NULL && (m->flags & PG_ZERO) == 0) {
|
if (m != NULL && (m->flags & PG_ZERO) == 0) {
|
||||||
vm_page_queues[m->queue].lcnt--;
|
vm_page_queues[m->queue].lcnt--;
|
||||||
TAILQ_REMOVE(vm_page_queues[m->queue].pl, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[m->queue].pl, m, pageq);
|
||||||
m->queue = PQ_NONE;
|
m->queue = PQ_NONE;
|
||||||
splx(s);
|
splx(s);
|
||||||
#if 0
|
#if 0
|
||||||
@ -568,7 +568,7 @@ vm_page_zero_idle()
|
|||||||
vm_page_flag_set(m, PG_ZERO);
|
vm_page_flag_set(m, PG_ZERO);
|
||||||
m->queue = PQ_FREE + m->pc;
|
m->queue = PQ_FREE + m->pc;
|
||||||
vm_page_queues[m->queue].lcnt++;
|
vm_page_queues[m->queue].lcnt++;
|
||||||
TAILQ_INSERT_TAIL(vm_page_queues[m->queue].pl, m,
|
TAILQ_INSERT_TAIL(&vm_page_queues[m->queue].pl, m,
|
||||||
pageq);
|
pageq);
|
||||||
++vm_page_zero_count;
|
++vm_page_zero_count;
|
||||||
++cnt_prezero;
|
++cnt_prezero;
|
||||||
|
@ -422,7 +422,7 @@ vm_page_zero_idle()
|
|||||||
zero_state = 0;
|
zero_state = 0;
|
||||||
if (m != NULL && (m->flags & PG_ZERO) == 0) {
|
if (m != NULL && (m->flags & PG_ZERO) == 0) {
|
||||||
vm_page_queues[m->queue].lcnt--;
|
vm_page_queues[m->queue].lcnt--;
|
||||||
TAILQ_REMOVE(vm_page_queues[m->queue].pl, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[m->queue].pl, m, pageq);
|
||||||
m->queue = PQ_NONE;
|
m->queue = PQ_NONE;
|
||||||
splx(s);
|
splx(s);
|
||||||
#if 0
|
#if 0
|
||||||
@ -436,7 +436,7 @@ vm_page_zero_idle()
|
|||||||
vm_page_flag_set(m, PG_ZERO);
|
vm_page_flag_set(m, PG_ZERO);
|
||||||
m->queue = PQ_FREE + m->pc;
|
m->queue = PQ_FREE + m->pc;
|
||||||
vm_page_queues[m->queue].lcnt++;
|
vm_page_queues[m->queue].lcnt++;
|
||||||
TAILQ_INSERT_TAIL(vm_page_queues[m->queue].pl, m,
|
TAILQ_INSERT_TAIL(&vm_page_queues[m->queue].pl, m,
|
||||||
pageq);
|
pageq);
|
||||||
++vm_page_zero_count;
|
++vm_page_zero_count;
|
||||||
++cnt_prezero;
|
++cnt_prezero;
|
||||||
|
@ -422,7 +422,7 @@ vm_page_zero_idle()
|
|||||||
zero_state = 0;
|
zero_state = 0;
|
||||||
if (m != NULL && (m->flags & PG_ZERO) == 0) {
|
if (m != NULL && (m->flags & PG_ZERO) == 0) {
|
||||||
vm_page_queues[m->queue].lcnt--;
|
vm_page_queues[m->queue].lcnt--;
|
||||||
TAILQ_REMOVE(vm_page_queues[m->queue].pl, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[m->queue].pl, m, pageq);
|
||||||
m->queue = PQ_NONE;
|
m->queue = PQ_NONE;
|
||||||
splx(s);
|
splx(s);
|
||||||
#if 0
|
#if 0
|
||||||
@ -436,7 +436,7 @@ vm_page_zero_idle()
|
|||||||
vm_page_flag_set(m, PG_ZERO);
|
vm_page_flag_set(m, PG_ZERO);
|
||||||
m->queue = PQ_FREE + m->pc;
|
m->queue = PQ_FREE + m->pc;
|
||||||
vm_page_queues[m->queue].lcnt++;
|
vm_page_queues[m->queue].lcnt++;
|
||||||
TAILQ_INSERT_TAIL(vm_page_queues[m->queue].pl, m,
|
TAILQ_INSERT_TAIL(&vm_page_queues[m->queue].pl, m,
|
||||||
pageq);
|
pageq);
|
||||||
++vm_page_zero_count;
|
++vm_page_zero_count;
|
||||||
++cnt_prezero;
|
++cnt_prezero;
|
||||||
|
@ -98,36 +98,23 @@ static int vm_page_bucket_count; /* How big is array? */
|
|||||||
static int vm_page_hash_mask; /* Mask for hash function */
|
static int vm_page_hash_mask; /* Mask for hash function */
|
||||||
static volatile int vm_page_bucket_generation;
|
static volatile int vm_page_bucket_generation;
|
||||||
|
|
||||||
struct pglist vm_page_queue_free[PQ_L2_SIZE] = {{0}};
|
struct vpgqueues vm_page_queues[PQ_COUNT];
|
||||||
struct pglist vm_page_queue_active = {0};
|
|
||||||
struct pglist vm_page_queue_inactive = {0};
|
|
||||||
struct pglist vm_page_queue_cache[PQ_L2_SIZE] = {{0}};
|
|
||||||
|
|
||||||
struct vpgqueues vm_page_queues[PQ_COUNT] = {{0}};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vm_page_queue_init(void) {
|
vm_page_queue_init(void) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i=0;i<PQ_L2_SIZE;i++) {
|
for(i=0;i<PQ_L2_SIZE;i++) {
|
||||||
vm_page_queues[PQ_FREE+i].pl = &vm_page_queue_free[i];
|
|
||||||
vm_page_queues[PQ_FREE+i].cnt = &cnt.v_free_count;
|
vm_page_queues[PQ_FREE+i].cnt = &cnt.v_free_count;
|
||||||
}
|
}
|
||||||
vm_page_queues[PQ_INACTIVE].pl = &vm_page_queue_inactive;
|
|
||||||
vm_page_queues[PQ_INACTIVE].cnt = &cnt.v_inactive_count;
|
vm_page_queues[PQ_INACTIVE].cnt = &cnt.v_inactive_count;
|
||||||
|
|
||||||
vm_page_queues[PQ_ACTIVE].pl = &vm_page_queue_active;
|
|
||||||
vm_page_queues[PQ_ACTIVE].cnt = &cnt.v_active_count;
|
vm_page_queues[PQ_ACTIVE].cnt = &cnt.v_active_count;
|
||||||
for(i=0;i<PQ_L2_SIZE;i++) {
|
for(i=0;i<PQ_L2_SIZE;i++) {
|
||||||
vm_page_queues[PQ_CACHE+i].pl = &vm_page_queue_cache[i];
|
|
||||||
vm_page_queues[PQ_CACHE+i].cnt = &cnt.v_cache_count;
|
vm_page_queues[PQ_CACHE+i].cnt = &cnt.v_cache_count;
|
||||||
}
|
}
|
||||||
for(i=PQ_FREE;i<PQ_COUNT;i++) {
|
for(i=0;i<PQ_COUNT;i++) {
|
||||||
if (vm_page_queues[i].pl) {
|
TAILQ_INIT(&vm_page_queues[i].pl);
|
||||||
TAILQ_INIT(vm_page_queues[i].pl);
|
|
||||||
} else {
|
|
||||||
panic("vm_page_queue_init: queue %d is null", i);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +303,7 @@ vm_page_startup(starta, enda, vaddr)
|
|||||||
m->flags = 0;
|
m->flags = 0;
|
||||||
m->pc = (pa >> PAGE_SHIFT) & PQ_L2_MASK;
|
m->pc = (pa >> PAGE_SHIFT) & PQ_L2_MASK;
|
||||||
m->queue = m->pc + PQ_FREE;
|
m->queue = m->pc + PQ_FREE;
|
||||||
TAILQ_INSERT_HEAD(vm_page_queues[m->queue].pl, m, pageq);
|
TAILQ_INSERT_HEAD(&vm_page_queues[m->queue].pl, m, pageq);
|
||||||
vm_page_queues[m->queue].lcnt++;
|
vm_page_queues[m->queue].lcnt++;
|
||||||
pa += PAGE_SIZE;
|
pa += PAGE_SIZE;
|
||||||
}
|
}
|
||||||
@ -586,7 +573,7 @@ vm_page_unqueue_nowakeup(m)
|
|||||||
if (queue != PQ_NONE) {
|
if (queue != PQ_NONE) {
|
||||||
pq = &vm_page_queues[queue];
|
pq = &vm_page_queues[queue];
|
||||||
m->queue = PQ_NONE;
|
m->queue = PQ_NONE;
|
||||||
TAILQ_REMOVE(pq->pl, m, pageq);
|
TAILQ_REMOVE(&pq->pl, m, pageq);
|
||||||
(*pq->cnt)--;
|
(*pq->cnt)--;
|
||||||
pq->lcnt--;
|
pq->lcnt--;
|
||||||
}
|
}
|
||||||
@ -610,7 +597,7 @@ vm_page_unqueue(m)
|
|||||||
if (queue != PQ_NONE) {
|
if (queue != PQ_NONE) {
|
||||||
m->queue = PQ_NONE;
|
m->queue = PQ_NONE;
|
||||||
pq = &vm_page_queues[queue];
|
pq = &vm_page_queues[queue];
|
||||||
TAILQ_REMOVE(pq->pl, m, pageq);
|
TAILQ_REMOVE(&pq->pl, m, pageq);
|
||||||
(*pq->cnt)--;
|
(*pq->cnt)--;
|
||||||
pq->lcnt--;
|
pq->lcnt--;
|
||||||
if ((queue - m->pc) == PQ_CACHE) {
|
if ((queue - m->pc) == PQ_CACHE) {
|
||||||
@ -656,10 +643,10 @@ _vm_page_list_find(basequeue, index)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
for(i = PQ_L2_SIZE / 2; i > 0; --i) {
|
for(i = PQ_L2_SIZE / 2; i > 0; --i) {
|
||||||
if ((m = TAILQ_FIRST(pq[(index + i) & PQ_L2_MASK].pl)) != NULL)
|
if ((m = TAILQ_FIRST(&pq[(index + i) & PQ_L2_MASK].pl)) != NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ((m = TAILQ_FIRST(pq[(index - i) & PQ_L2_MASK].pl)) != NULL)
|
if ((m = TAILQ_FIRST(&pq[(index - i) & PQ_L2_MASK].pl)) != NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return(m);
|
return(m);
|
||||||
@ -833,7 +820,7 @@ vm_page_alloc(object, pindex, page_req)
|
|||||||
{
|
{
|
||||||
struct vpgqueues *pq = &vm_page_queues[m->queue];
|
struct vpgqueues *pq = &vm_page_queues[m->queue];
|
||||||
|
|
||||||
TAILQ_REMOVE(pq->pl, m, pageq);
|
TAILQ_REMOVE(&pq->pl, m, pageq);
|
||||||
(*pq->cnt)--;
|
(*pq->cnt)--;
|
||||||
pq->lcnt--;
|
pq->lcnt--;
|
||||||
}
|
}
|
||||||
@ -1009,7 +996,7 @@ vm_page_activate(m)
|
|||||||
if (m->wire_count == 0) {
|
if (m->wire_count == 0) {
|
||||||
m->queue = PQ_ACTIVE;
|
m->queue = PQ_ACTIVE;
|
||||||
vm_page_queues[PQ_ACTIVE].lcnt++;
|
vm_page_queues[PQ_ACTIVE].lcnt++;
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_active, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
if (m->act_count < ACT_INIT)
|
if (m->act_count < ACT_INIT)
|
||||||
m->act_count = ACT_INIT;
|
m->act_count = ACT_INIT;
|
||||||
cnt.v_active_count++;
|
cnt.v_active_count++;
|
||||||
@ -1158,10 +1145,10 @@ vm_page_free_toq(vm_page_t m)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (m->flags & PG_ZERO) {
|
if (m->flags & PG_ZERO) {
|
||||||
TAILQ_INSERT_TAIL(pq->pl, m, pageq);
|
TAILQ_INSERT_TAIL(&pq->pl, m, pageq);
|
||||||
++vm_page_zero_count;
|
++vm_page_zero_count;
|
||||||
} else {
|
} else {
|
||||||
TAILQ_INSERT_HEAD(pq->pl, m, pageq);
|
TAILQ_INSERT_HEAD(&pq->pl, m, pageq);
|
||||||
}
|
}
|
||||||
|
|
||||||
vm_page_free_wakeup();
|
vm_page_free_wakeup();
|
||||||
@ -1234,12 +1221,12 @@ vm_page_unwire(m, activate)
|
|||||||
if (m->wire_count == 0) {
|
if (m->wire_count == 0) {
|
||||||
cnt.v_wire_count--;
|
cnt.v_wire_count--;
|
||||||
if (activate) {
|
if (activate) {
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_active, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
m->queue = PQ_ACTIVE;
|
m->queue = PQ_ACTIVE;
|
||||||
vm_page_queues[PQ_ACTIVE].lcnt++;
|
vm_page_queues[PQ_ACTIVE].lcnt++;
|
||||||
cnt.v_active_count++;
|
cnt.v_active_count++;
|
||||||
} else {
|
} else {
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_inactive, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
m->queue = PQ_INACTIVE;
|
m->queue = PQ_INACTIVE;
|
||||||
vm_page_queues[PQ_INACTIVE].lcnt++;
|
vm_page_queues[PQ_INACTIVE].lcnt++;
|
||||||
cnt.v_inactive_count++;
|
cnt.v_inactive_count++;
|
||||||
@ -1281,9 +1268,9 @@ _vm_page_deactivate(vm_page_t m, int athead)
|
|||||||
cnt.v_reactivated++;
|
cnt.v_reactivated++;
|
||||||
vm_page_unqueue(m);
|
vm_page_unqueue(m);
|
||||||
if (athead)
|
if (athead)
|
||||||
TAILQ_INSERT_HEAD(&vm_page_queue_inactive, m, pageq);
|
TAILQ_INSERT_HEAD(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
else
|
else
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_inactive, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
m->queue = PQ_INACTIVE;
|
m->queue = PQ_INACTIVE;
|
||||||
vm_page_queues[PQ_INACTIVE].lcnt++;
|
vm_page_queues[PQ_INACTIVE].lcnt++;
|
||||||
cnt.v_inactive_count++;
|
cnt.v_inactive_count++;
|
||||||
@ -1335,7 +1322,7 @@ vm_page_cache(m)
|
|||||||
vm_page_unqueue_nowakeup(m);
|
vm_page_unqueue_nowakeup(m);
|
||||||
m->queue = PQ_CACHE + m->pc;
|
m->queue = PQ_CACHE + m->pc;
|
||||||
vm_page_queues[m->queue].lcnt++;
|
vm_page_queues[m->queue].lcnt++;
|
||||||
TAILQ_INSERT_TAIL(vm_page_queues[m->queue].pl, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[m->queue].pl, m, pageq);
|
||||||
cnt.v_cache_count++;
|
cnt.v_cache_count++;
|
||||||
vm_page_free_wakeup();
|
vm_page_free_wakeup();
|
||||||
splx(s);
|
splx(s);
|
||||||
@ -1746,7 +1733,7 @@ contigmalloc1(size, type, flags, low, high, alignment, boundary, map)
|
|||||||
vm_page_t m, next;
|
vm_page_t m, next;
|
||||||
|
|
||||||
again1:
|
again1:
|
||||||
for (m = TAILQ_FIRST(&vm_page_queue_inactive);
|
for (m = TAILQ_FIRST(&vm_page_queues[PQ_INACTIVE].pl);
|
||||||
m != NULL;
|
m != NULL;
|
||||||
m = next) {
|
m = next) {
|
||||||
|
|
||||||
@ -1773,7 +1760,7 @@ contigmalloc1(size, type, flags, low, high, alignment, boundary, map)
|
|||||||
vm_page_cache(m);
|
vm_page_cache(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (m = TAILQ_FIRST(&vm_page_queue_active);
|
for (m = TAILQ_FIRST(&vm_page_queues[PQ_ACTIVE].pl);
|
||||||
m != NULL;
|
m != NULL;
|
||||||
m = next) {
|
m = next) {
|
||||||
|
|
||||||
@ -1829,7 +1816,7 @@ contigmalloc1(size, type, flags, low, high, alignment, boundary, map)
|
|||||||
vm_page_free(m);
|
vm_page_free(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_REMOVE(vm_page_queues[m->queue].pl, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[m->queue].pl, m, pageq);
|
||||||
vm_page_queues[m->queue].lcnt--;
|
vm_page_queues[m->queue].lcnt--;
|
||||||
cnt.v_free_count--;
|
cnt.v_free_count--;
|
||||||
m->valid = VM_PAGE_BITS_ALL;
|
m->valid = VM_PAGE_BITS_ALL;
|
||||||
|
@ -210,11 +210,13 @@ struct vm_page {
|
|||||||
#define PQ_COUNT (2 + 2*PQ_L2_SIZE)
|
#define PQ_COUNT (2 + 2*PQ_L2_SIZE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern struct vpgqueues {
|
struct vpgqueues {
|
||||||
struct pglist *pl;
|
struct pglist pl;
|
||||||
int *cnt;
|
int *cnt;
|
||||||
int lcnt;
|
int lcnt;
|
||||||
} vm_page_queues[PQ_COUNT];
|
};
|
||||||
|
|
||||||
|
extern struct vpgqueues vm_page_queues[PQ_COUNT];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -272,15 +274,6 @@ extern struct vpgqueues {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(KLD_MODULE)
|
|
||||||
|
|
||||||
extern struct pglist vm_page_queue_free[PQ_L2_SIZE];/* memory free queue */
|
|
||||||
extern struct pglist vm_page_queue_active; /* active memory queue */
|
|
||||||
extern struct pglist vm_page_queue_inactive; /* inactive memory queue */
|
|
||||||
extern struct pglist vm_page_queue_cache[PQ_L2_SIZE];/* cache memory queue */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern int vm_page_zero_count;
|
extern int vm_page_zero_count;
|
||||||
|
|
||||||
extern vm_page_t vm_page_array; /* First resident page in table */
|
extern vm_page_t vm_page_array; /* First resident page in table */
|
||||||
@ -595,17 +588,17 @@ vm_page_list_find(int basequeue, int index, boolean_t prefer_zero)
|
|||||||
|
|
||||||
#if PQ_L2_SIZE > 1
|
#if PQ_L2_SIZE > 1
|
||||||
if (prefer_zero) {
|
if (prefer_zero) {
|
||||||
m = TAILQ_LAST(vm_page_queues[basequeue+index].pl, pglist);
|
m = TAILQ_LAST(&vm_page_queues[basequeue+index].pl, pglist);
|
||||||
} else {
|
} else {
|
||||||
m = TAILQ_FIRST(vm_page_queues[basequeue+index].pl);
|
m = TAILQ_FIRST(&vm_page_queues[basequeue+index].pl);
|
||||||
}
|
}
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
m = _vm_page_list_find(basequeue, index);
|
m = _vm_page_list_find(basequeue, index);
|
||||||
#else
|
#else
|
||||||
if (prefer_zero) {
|
if (prefer_zero) {
|
||||||
m = TAILQ_LAST(vm_page_queues[basequeue].pl, pglist);
|
m = TAILQ_LAST(&vm_page_queues[basequeue].pl, pglist);
|
||||||
} else {
|
} else {
|
||||||
m = TAILQ_FIRST(vm_page_queues[basequeue].pl);
|
m = TAILQ_FIRST(&vm_page_queues[basequeue].pl);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return(m);
|
return(m);
|
||||||
|
@ -500,8 +500,8 @@ vm_pageout_object_deactivate_pages(map, object, desired, map_remove_only)
|
|||||||
vm_page_deactivate(p);
|
vm_page_deactivate(p);
|
||||||
} else {
|
} else {
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_active, p, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_ACTIVE].pl, p, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_active, p, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_ACTIVE].pl, p, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -510,8 +510,8 @@ vm_pageout_object_deactivate_pages(map, object, desired, map_remove_only)
|
|||||||
if (p->act_count < (ACT_MAX - ACT_ADVANCE))
|
if (p->act_count < (ACT_MAX - ACT_ADVANCE))
|
||||||
p->act_count += ACT_ADVANCE;
|
p->act_count += ACT_ADVANCE;
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_active, p, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_ACTIVE].pl, p, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_active, p, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_ACTIVE].pl, p, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
}
|
}
|
||||||
} else if (p->queue == PQ_INACTIVE) {
|
} else if (p->queue == PQ_INACTIVE) {
|
||||||
@ -674,7 +674,7 @@ vm_pageout_scan()
|
|||||||
rescan0:
|
rescan0:
|
||||||
addl_page_shortage = addl_page_shortage_init;
|
addl_page_shortage = addl_page_shortage_init;
|
||||||
maxscan = cnt.v_inactive_count;
|
maxscan = cnt.v_inactive_count;
|
||||||
for (m = TAILQ_FIRST(&vm_page_queue_inactive);
|
for (m = TAILQ_FIRST(&vm_page_queues[PQ_INACTIVE].pl);
|
||||||
m != NULL && maxscan-- > 0 && page_shortage > 0;
|
m != NULL && maxscan-- > 0 && page_shortage > 0;
|
||||||
m = next) {
|
m = next) {
|
||||||
|
|
||||||
@ -688,8 +688,8 @@ vm_pageout_scan()
|
|||||||
|
|
||||||
if (m->hold_count) {
|
if (m->hold_count) {
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_inactive, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_inactive, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
addl_page_shortage++;
|
addl_page_shortage++;
|
||||||
continue;
|
continue;
|
||||||
@ -794,8 +794,8 @@ vm_pageout_scan()
|
|||||||
*/
|
*/
|
||||||
if (!swap_pageouts_ok || (object->flags & OBJ_DEAD)) {
|
if (!swap_pageouts_ok || (object->flags & OBJ_DEAD)) {
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_inactive, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_inactive, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -816,8 +816,8 @@ vm_pageout_scan()
|
|||||||
object->type != OBJT_SWAP &&
|
object->type != OBJT_SWAP &&
|
||||||
cnt.v_free_count < cnt.v_free_reserved) {
|
cnt.v_free_count < cnt.v_free_reserved) {
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_inactive, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_inactive, m,
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m,
|
||||||
pageq);
|
pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
continue;
|
continue;
|
||||||
@ -860,8 +860,8 @@ vm_pageout_scan()
|
|||||||
(m->busy == 0) &&
|
(m->busy == 0) &&
|
||||||
(m->flags & PG_BUSY) == 0) {
|
(m->flags & PG_BUSY) == 0) {
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_inactive, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_inactive, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
}
|
}
|
||||||
if (object->flags & OBJ_MIGHTBEDIRTY)
|
if (object->flags & OBJ_MIGHTBEDIRTY)
|
||||||
@ -895,8 +895,8 @@ vm_pageout_scan()
|
|||||||
*/
|
*/
|
||||||
if (m->hold_count) {
|
if (m->hold_count) {
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_inactive, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_inactive, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_INACTIVE].pl, m, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
if (object->flags & OBJ_MIGHTBEDIRTY)
|
if (object->flags & OBJ_MIGHTBEDIRTY)
|
||||||
vnodes_skipped++;
|
vnodes_skipped++;
|
||||||
@ -946,7 +946,7 @@ vm_pageout_scan()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
pcount = cnt.v_active_count;
|
pcount = cnt.v_active_count;
|
||||||
m = TAILQ_FIRST(&vm_page_queue_active);
|
m = TAILQ_FIRST(&vm_page_queues[PQ_ACTIVE].pl);
|
||||||
|
|
||||||
while ((m != NULL) && (pcount-- > 0) && (page_shortage > 0)) {
|
while ((m != NULL) && (pcount-- > 0) && (page_shortage > 0)) {
|
||||||
|
|
||||||
@ -966,8 +966,8 @@ vm_pageout_scan()
|
|||||||
(m->flags & PG_BUSY) ||
|
(m->flags & PG_BUSY) ||
|
||||||
(m->hold_count != 0)) {
|
(m->hold_count != 0)) {
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_active, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_active, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
m = next;
|
m = next;
|
||||||
continue;
|
continue;
|
||||||
@ -1006,8 +1006,8 @@ vm_pageout_scan()
|
|||||||
*/
|
*/
|
||||||
if (actcount && (m->object->ref_count != 0)) {
|
if (actcount && (m->object->ref_count != 0)) {
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_active, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_active, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
} else {
|
} else {
|
||||||
m->act_count -= min(m->act_count, ACT_DECLINE);
|
m->act_count -= min(m->act_count, ACT_DECLINE);
|
||||||
@ -1025,8 +1025,8 @@ vm_pageout_scan()
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_active, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_active, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1167,7 +1167,7 @@ vm_pageout_page_stats()
|
|||||||
pcount = tpcount;
|
pcount = tpcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
m = TAILQ_FIRST(&vm_page_queue_active);
|
m = TAILQ_FIRST(&vm_page_queues[PQ_ACTIVE].pl);
|
||||||
while ((m != NULL) && (pcount-- > 0)) {
|
while ((m != NULL) && (pcount-- > 0)) {
|
||||||
int actcount;
|
int actcount;
|
||||||
|
|
||||||
@ -1183,8 +1183,8 @@ vm_pageout_page_stats()
|
|||||||
(m->flags & PG_BUSY) ||
|
(m->flags & PG_BUSY) ||
|
||||||
(m->hold_count != 0)) {
|
(m->hold_count != 0)) {
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_active, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_active, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
m = next;
|
m = next;
|
||||||
continue;
|
continue;
|
||||||
@ -1202,8 +1202,8 @@ vm_pageout_page_stats()
|
|||||||
if (m->act_count > ACT_MAX)
|
if (m->act_count > ACT_MAX)
|
||||||
m->act_count = ACT_MAX;
|
m->act_count = ACT_MAX;
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_active, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_active, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
} else {
|
} else {
|
||||||
if (m->act_count == 0) {
|
if (m->act_count == 0) {
|
||||||
@ -1219,8 +1219,8 @@ vm_pageout_page_stats()
|
|||||||
} else {
|
} else {
|
||||||
m->act_count -= min(m->act_count, ACT_DECLINE);
|
m->act_count -= min(m->act_count, ACT_DECLINE);
|
||||||
s = splvm();
|
s = splvm();
|
||||||
TAILQ_REMOVE(&vm_page_queue_active, m, pageq);
|
TAILQ_REMOVE(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
TAILQ_INSERT_TAIL(&vm_page_queue_active, m, pageq);
|
TAILQ_INSERT_TAIL(&vm_page_queues[PQ_ACTIVE].pl, m, pageq);
|
||||||
splx(s);
|
splx(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user