From 9c75ede409d60f494cbb4b5c953e103ca672a0df Mon Sep 17 00:00:00 2001 From: ups Date: Thu, 8 Nov 2007 14:47:55 +0000 Subject: Initial checkin for rmlock (read mostly lock) a multi reader single writer lock optimized for almost exclusive reader access. (see also rmlock.9) TODO: Convert to per cpu variables linkerset as soon as it is available. Optimize UP (single processor) case. --- sys/kern/subr_pcpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sys/kern/subr_pcpu.c') diff --git a/sys/kern/subr_pcpu.c b/sys/kern/subr_pcpu.c index bf9b0c7..1109b31 100644 --- a/sys/kern/subr_pcpu.c +++ b/sys/kern/subr_pcpu.c @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include -static struct pcpu *cpuid_to_pcpu[MAXCPU]; +struct pcpu *cpuid_to_pcpu[MAXCPU]; struct cpuhead cpuhead = SLIST_HEAD_INITIALIZER(cpuhead); /* @@ -74,6 +74,9 @@ pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) cpuid_to_pcpu[cpuid] = pcpu; SLIST_INSERT_HEAD(&cpuhead, pcpu, pc_allcpu); cpu_pcpu_init(pcpu, cpuid, size); + pcpu->pc_rm_queue.rmq_next = &pcpu->pc_rm_queue; + pcpu->pc_rm_queue.rmq_prev = &pcpu->pc_rm_queue; + } /* -- cgit v1.1