diff options
author | alc <alc@FreeBSD.org> | 2009-10-04 18:53:10 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 2009-10-04 18:53:10 +0000 |
commit | dce82c729ad5fad175b28be442aaeb21238ab652 (patch) | |
tree | be275d228074caa6157dd1b24163b60d48a2a2c5 | |
parent | a7b48c5ecbcfad7c59495279f0391a8f30450f6b (diff) | |
download | FreeBSD-src-dce82c729ad5fad175b28be442aaeb21238ab652.zip FreeBSD-src-dce82c729ad5fad175b28be442aaeb21238ab652.tar.gz |
Align and pad the page queue and free page queue locks so that the linker
can't possibly place them together within the same cache line.
MFC after: 3 weeks
-rw-r--r-- | sys/vm/vm_page.c | 4 | ||||
-rw-r--r-- | sys/vm/vm_page.h | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index ac363b7..c6bcfa0 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -135,8 +135,8 @@ __FBSDID("$FreeBSD$"); */ struct vpgqueues vm_page_queues[PQ_COUNT]; -struct mtx vm_page_queue_mtx; -struct mtx vm_page_queue_free_mtx; +struct vpglocks vm_page_queue_lock; +struct vpglocks vm_page_queue_free_lock; vm_page_t vm_page_array = 0; int vm_page_array_size = 0; diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index b1b1070..662af98 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -170,7 +170,15 @@ struct vpgqueues { }; extern struct vpgqueues vm_page_queues[PQ_COUNT]; -extern struct mtx vm_page_queue_free_mtx; + +struct vpglocks { + struct mtx data; + char pad[CACHE_LINE_SIZE - sizeof(struct mtx)]; +} __aligned(CACHE_LINE_SIZE); + +extern struct vpglocks vm_page_queue_free_lock; + +#define vm_page_queue_free_mtx vm_page_queue_free_lock.data /* * These are the flags defined for vm_page. @@ -258,7 +266,9 @@ PHYS_TO_VM_PAGE(vm_paddr_t pa) #endif } -extern struct mtx vm_page_queue_mtx; +extern struct vpglocks vm_page_queue_lock; + +#define vm_page_queue_mtx vm_page_queue_lock.data #define vm_page_lock_queues() mtx_lock(&vm_page_queue_mtx) #define vm_page_unlock_queues() mtx_unlock(&vm_page_queue_mtx) |