diff options
author | peter <peter@FreeBSD.org> | 2002-01-05 09:35:50 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2002-01-05 09:35:50 +0000 |
commit | d0a39cc230c0913e147d6d457395dacacde596b3 (patch) | |
tree | 000b086daa494cae67749c9e15635aace521e8ad | |
parent | 1ce407b6755fc202866c4e1e2887b37a6fc09a9a (diff) | |
download | FreeBSD-src-d0a39cc230c0913e147d6d457395dacacde596b3.zip FreeBSD-src-d0a39cc230c0913e147d6d457395dacacde596b3.tar.gz |
Add a per-cpu variable, cpumask, the preshifted equivalent of 1 << cpuid.
We use this around the place a lot.
-rw-r--r-- | sys/kern/subr_pcpu.c | 1 | ||||
-rw-r--r-- | sys/sys/pcpu.h | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/subr_pcpu.c b/sys/kern/subr_pcpu.c index 8db9e1f..132e957 100644 --- a/sys/kern/subr_pcpu.c +++ b/sys/kern/subr_pcpu.c @@ -68,6 +68,7 @@ pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) KASSERT(cpuid >= 0 && cpuid < MAXCPU, ("pcpu_init: invalid cpuid %d", cpuid)); pcpu->pc_cpuid = cpuid; + pcpu->pc_cpumask = 1 << cpuid; cpuid_to_pcpu[cpuid] = pcpu; SLIST_INSERT_HEAD(&cpuhead, pcpu, pc_allcpu); cpu_pcpu_init(pcpu, cpuid, size); diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h index a4f9f43..8cdaf76 100644 --- a/sys/sys/pcpu.h +++ b/sys/sys/pcpu.h @@ -55,7 +55,8 @@ struct pcpu { struct timeval pc_switchtime; int pc_switchticks; u_int pc_cpuid; /* This cpu number */ - u_int pc_other_cpus; /* All other cpus */ + u_int pc_cpumask; /* This cpu mask */ + u_int pc_other_cpus; /* Mask of all other cpus */ SLIST_ENTRY(pcpu) pc_allcpu; struct lock_list_entry *pc_spinlocks; #ifdef KTR_PERCPU |