summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_page.h
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2012-10-31 18:07:18 +0000
committerattilio <attilio@FreeBSD.org>2012-10-31 18:07:18 +0000
commitd38d7bb24528def9112ecd75c967b4202e87cc4e (patch)
tree6e28b3206316703630ba5a9b796a652c5c2bf190 /sys/vm/vm_page.h
parent8fbe05091504259bdb07f38b21e970c6f172b8cd (diff)
downloadFreeBSD-src-d38d7bb24528def9112ecd75c967b4202e87cc4e.zip
FreeBSD-src-d38d7bb24528def9112ecd75c967b4202e87cc4e.tar.gz
Rework the known mutexes to benefit about staying on their own
cache line in order to avoid manual frobbing but using struct mtx_padalign. The sole exception being nvme and sxfge drivers, where the author redefined CACHE_LINE_SIZE manually, so they need to be analyzed and dealt with separately. Reviwed by: jimharris, alc
Diffstat (limited to 'sys/vm/vm_page.h')
-rw-r--r--sys/vm/vm_page.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
index a7f0d98..70b8416 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -187,13 +187,8 @@ struct vpgqueues {
extern struct vpgqueues vm_page_queues[PQ_COUNT];
-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;
-extern struct vpglocks pa_lock[];
+extern struct mtx_padalign vm_page_queue_free_mtx;
+extern struct mtx_padalign pa_lock[];
#if defined(__arm__)
#define PDRSHIFT PDR_SHIFT
@@ -202,7 +197,7 @@ extern struct vpglocks pa_lock[];
#endif
#define pa_index(pa) ((pa) >> PDRSHIFT)
-#define PA_LOCKPTR(pa) &pa_lock[pa_index((pa)) % PA_LOCK_COUNT].data
+#define PA_LOCKPTR(pa) ((struct mtx *)(&pa_lock[pa_index(pa) % PA_LOCK_COUNT]))
#define PA_LOCKOBJPTR(pa) ((struct lock_object *)PA_LOCKPTR((pa)))
#define PA_LOCK(pa) mtx_lock(PA_LOCKPTR(pa))
#define PA_TRYLOCK(pa) mtx_trylock(PA_LOCKPTR(pa))
@@ -235,8 +230,6 @@ extern struct vpglocks pa_lock[];
#define vm_page_lock_assert(m, a) mtx_assert(vm_page_lockptr((m)), (a))
#endif
-#define vm_page_queue_free_mtx vm_page_queue_free_lock.data
-
/*
* The vm_page's aflags are updated using atomic operations. To set or clear
* these flags, the functions vm_page_aflag_set() and vm_page_aflag_clear()
@@ -327,9 +320,8 @@ vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa);
vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa);
-extern struct vpglocks vm_page_queue_lock;
+extern struct mtx_padalign vm_page_queue_mtx;
-#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)
OpenPOWER on IntegriCloud