Remove namespace pollution in _rmlock.h by defining rm_queue structure

directly in _rmlock.h and then including it (and its dependencies)
in pcpu.h. This leads to few _*.h headers to be included in pcpu.h
but this is not considered a big deal.

Really pc_rm_queue should be implemented as a dynamic member with
DPCPU interface, but we really want to keep the read acquisition as
fast as possible, so even the further pc_dynamic indirection should be
avoided, and the pollution is dealt like this.

Discussed with:	jhb
MFC after:	1 week
This commit is contained in:
Attilio Rao 2012-09-18 00:43:15 +00:00
parent d94f2d7f34
commit 6a612df12c
2 changed files with 10 additions and 23 deletions

View File

@ -32,17 +32,17 @@
#ifndef _SYS__RMLOCK_H_
#define _SYS__RMLOCK_H_
/*
* XXXUPS remove as soon as we have per cpu variable
* linker sets and can define rm_queue in _rm_lock.h
*/
#include <sys/pcpu.h>
/*
* Mostly reader/occasional writer lock.
*/
LIST_HEAD(rmpriolist,rm_priotracker);
struct rm_queue {
struct rm_queue *volatile rmq_next;
struct rm_queue *volatile rmq_prev;
};
struct rmlock {
struct lock_object lock_object;
volatile cpuset_t rm_writecpus;

View File

@ -38,7 +38,11 @@
#endif
#include <sys/_cpuset.h>
#include <sys/_lock.h>
#include <sys/_mutex.h>
#include <sys/_sx.h>
#include <sys/queue.h>
#include <sys/_rmlock.h>
#include <sys/vmmeter.h>
#include <sys/resource.h>
#include <machine/pcpu.h>
@ -137,15 +141,6 @@ extern uintptr_t dpcpu_off[];
#endif /* _KERNEL */
/*
* XXXUPS remove as soon as we have per cpu variable
* linker sets and can define rm_queue in _rm_lock.h
*/
struct rm_queue {
struct rm_queue* volatile rmq_next;
struct rm_queue* volatile rmq_prev;
};
/*
* This structure maps out the global data that needs to be kept on a
* per-cpu basis. The members are accessed via the PCPU_GET/SET/PTR
@ -169,15 +164,7 @@ struct pcpu {
void *pc_netisr; /* netisr SWI cookie */
int pc_dnweight; /* vm_page_dontneed() */
int pc_domain; /* Memory domain. */
/*
* Stuff for read mostly lock
*
* XXXUPS remove as soon as we have per cpu variable
* linker sets.
*/
struct rm_queue pc_rm_queue;
struct rm_queue pc_rm_queue; /* rmlock list of trackers */
uintptr_t pc_dynamic; /* Dynamic per-cpu data area */
/*