Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/vm_page.c
Show First 20 Lines • Show All 2,886 Lines • ▼ Show 20 Lines | else if ((object = atomic_load_ptr(&m->object)) != NULL) { | ||||
KASSERT(m->dirty == 0, | KASSERT(m->dirty == 0, | ||||
("page %p is dirty", m)); | ("page %p is dirty", m)); | ||||
} | } | ||||
} else | } else | ||||
error = EBUSY; | error = EBUSY; | ||||
unlock: | unlock: | ||||
VM_OBJECT_WUNLOCK(object); | VM_OBJECT_WUNLOCK(object); | ||||
} else { | } else { | ||||
MPASS(vm_phys_domain(m) == domain); | MPASS(vm_page_domain(m) == domain); | ||||
vmd = VM_DOMAIN(domain); | vmd = VM_DOMAIN(domain); | ||||
vm_domain_free_lock(vmd); | vm_domain_free_lock(vmd); | ||||
order = m->order; | order = m->order; | ||||
if (order < VM_NFREEORDER) { | if (order < VM_NFREEORDER) { | ||||
/* | /* | ||||
* The page is enqueued in the physical memory | * The page is enqueued in the physical memory | ||||
* allocator's free page queues. Moreover, it | * allocator's free page queues. Moreover, it | ||||
* is the first page in a power-of-two-sized | * is the first page in a power-of-two-sized | ||||
Show All 14 Lines | #endif | ||||
} | } | ||||
if ((m = SLIST_FIRST(&free)) != NULL) { | if ((m = SLIST_FIRST(&free)) != NULL) { | ||||
int cnt; | int cnt; | ||||
vmd = VM_DOMAIN(domain); | vmd = VM_DOMAIN(domain); | ||||
cnt = 0; | cnt = 0; | ||||
vm_domain_free_lock(vmd); | vm_domain_free_lock(vmd); | ||||
do { | do { | ||||
MPASS(vm_phys_domain(m) == domain); | MPASS(vm_page_domain(m) == domain); | ||||
SLIST_REMOVE_HEAD(&free, plinks.s.ss); | SLIST_REMOVE_HEAD(&free, plinks.s.ss); | ||||
vm_phys_free_pages(m, 0); | vm_phys_free_pages(m, 0); | ||||
cnt++; | cnt++; | ||||
} while ((m = SLIST_FIRST(&free)) != NULL); | } while ((m = SLIST_FIRST(&free)) != NULL); | ||||
vm_domain_free_unlock(vmd); | vm_domain_free_unlock(vmd); | ||||
vm_domain_freecnt_inc(vmd, cnt); | vm_domain_freecnt_inc(vmd, cnt); | ||||
} | } | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 657 Lines • ▼ Show 20 Lines | 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, | KASSERT((m->oflags & VPO_UNMANAGED) == 0, | ||||
("page %p is unmanaged", m)); | ("page %p is unmanaged", m)); | ||||
KASSERT(queue < PQ_COUNT, ("invalid queue %d", queue)); | KASSERT(queue < PQ_COUNT, ("invalid queue %d", queue)); | ||||
domain = vm_phys_domain(m); | domain = vm_page_domain(m); | ||||
pq = &vm_pagequeue_domain(m)->vmd_pagequeues[queue]; | pq = &vm_pagequeue_domain(m)->vmd_pagequeues[queue]; | ||||
alc: Could this (or should this) be micro-optimized to avoid the second call to vm_page_domain()… | |||||
markjAuthorUnsubmitted Done Inline ActionsYes, in fact I have that patch queued up in my tree. :) In GENERIC-NODEBUG it didn't appear to have an effect on code generation though. markj: Yes, in fact I have that patch queued up in my tree. :)
In GENERIC-NODEBUG it didn't appear to… | |||||
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; | ||||
} | } | ||||
critical_exit(); | critical_exit(); | ||||
▲ Show 20 Lines • Show All 1,921 Lines • Show Last 20 Lines |
Could this (or should this) be micro-optimized to avoid the second call to vm_page_domain() within vm_pagequeue_domain()?