Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_page.c
Show First 20 Lines • Show All 3,539 Lines • ▼ Show 20 Lines | KASSERT(pq == _vm_page_pagequeue(m, queue), | ||||
("%s: page %p does not belong to queue %p", __func__, m, pq)); | ("%s: page %p does not belong to queue %p", __func__, m, pq)); | ||||
for (old = vm_page_astate_load(m);;) { | for (old = vm_page_astate_load(m);;) { | ||||
if (__predict_false(old.queue != queue || | if (__predict_false(old.queue != queue || | ||||
(old.flags & PGA_QUEUE_OP_MASK) == 0)) { | (old.flags & PGA_QUEUE_OP_MASK) == 0)) { | ||||
counter_u64_add(queue_nops, 1); | counter_u64_add(queue_nops, 1); | ||||
break; | break; | ||||
} | } | ||||
KASSERT(old.queue != PQ_NONE || | KASSERT(old.queue != PQ_NONE || | ||||
(old.flags & PGA_QUEUE_STATE_MASK) == 0, | (old.flags & PGA_QUEUE_STATE_MASK) == 0, | ||||
("%s: page %p has unexpected queue state", __func__, m)); | ("%s: page %p has unexpected queue state", __func__, m)); | ||||
rlibby: I think the assert would be valid here in `vm_pqbatch_process_page()`? Since here we know that… | |||||
markjUnsubmitted Done Inline ActionsI agree with both of these statements. In other words, we should
markj: I agree with both of these statements. In other words, we should
- remove this assertion… | |||||
new = old; | new = old; | ||||
if ((old.flags & PGA_DEQUEUE) != 0) { | if ((old.flags & PGA_DEQUEUE) != 0) { | ||||
new.flags &= ~PGA_QUEUE_OP_MASK; | new.flags &= ~PGA_QUEUE_OP_MASK; | ||||
new.queue = PQ_NONE; | new.queue = PQ_NONE; | ||||
if (__predict_true(_vm_page_pqstate_commit_dequeue(pq, | if (__predict_true(_vm_page_pqstate_commit_dequeue(pq, | ||||
m, &old, new))) { | m, &old, new))) { | ||||
counter_u64_add(queue_ops, 1); | counter_u64_add(queue_ops, 1); | ||||
break; | break; | ||||
Show All 29 Lines | |||||
*/ | */ | ||||
void | void | ||||
vm_page_pqbatch_submit(vm_page_t m, uint8_t queue) | vm_page_pqbatch_submit(vm_page_t m, uint8_t queue) | ||||
{ | { | ||||
struct vm_batchqueue *bq; | struct vm_batchqueue *bq; | ||||
struct vm_pagequeue *pq; | struct vm_pagequeue *pq; | ||||
int domain; | int domain; | ||||
KASSERT((m->oflags & VPO_UNMANAGED) == 0, | |||||
("page %p is unmanaged", m)); | |||||
KASSERT(queue < PQ_COUNT, ("invalid queue %d", queue)); | KASSERT(queue < PQ_COUNT, ("invalid queue %d", queue)); | ||||
domain = vm_page_domain(m); | domain = vm_page_domain(m); | ||||
critical_enter(); | critical_enter(); | ||||
bq = DPCPU_PTR(pqbatch[domain][queue]); | bq = DPCPU_PTR(pqbatch[domain][queue]); | ||||
if (vm_batchqueue_insert(bq, m)) { | if (vm_batchqueue_insert(bq, m)) { | ||||
critical_exit(); | critical_exit(); | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 1,925 Lines • Show Last 20 Lines |
I think the assert would be valid here in vm_pqbatch_process_page()? Since here we know that we are (or were just) on a page queue, and we hold the pagequeue lock, and at least in vm_page_alloc_domain_after() we do the vm_page_dequeue() first and the assignment of oflags after that.
(Incidentally I think this assert here is also a little messed up, although harmless. The first condition is always true because we just established above that old.queue == queue, and we asserted at the top that queue < PQ_COUNT and we could _Static_assert(PQ_COUNT < PQ_NONE, ...).)