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
This commit is contained in:
Alan Cox 2009-10-04 18:53:10 +00:00
parent a7835d5578
commit e67e0775e6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=197750
2 changed files with 14 additions and 4 deletions

View File

@ -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;

View File

@ -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)