summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2007-06-06 07:35:08 +0000
committerdavidxu <davidxu@FreeBSD.org>2007-06-06 07:35:08 +0000
commit3a1a57d0eb8e8d05d4a48d6ded5313d836f2504d (patch)
tree5052dd6b94582ed601e9b5a970f9933bf177e726
parent3eb2cf672b15d9a2957d6883fb85d3428355f46c (diff)
downloadFreeBSD-src-3a1a57d0eb8e8d05d4a48d6ded5313d836f2504d.zip
FreeBSD-src-3a1a57d0eb8e8d05d4a48d6ded5313d836f2504d.tar.gz
Backout experimental adaptive-spin umtx code.
-rw-r--r--sys/amd64/amd64/cpu_switch.S2
-rw-r--r--sys/amd64/amd64/genassym.c1
-rw-r--r--sys/amd64/amd64/machdep.c1
-rw-r--r--sys/i386/i386/genassym.c1
-rw-r--r--sys/i386/i386/machdep.c1
-rw-r--r--sys/i386/i386/swtch.s1
-rw-r--r--sys/kern/kern_umtx.c67
-rw-r--r--sys/sys/pcpu.h1
-rw-r--r--sys/sys/umtx.h3
9 files changed, 1 insertions, 77 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
index 79a9f91..2d65667 100644
--- a/sys/amd64/amd64/cpu_switch.S
+++ b/sys/amd64/amd64/cpu_switch.S
@@ -203,9 +203,7 @@ sw1:
movq %rbx, (%rax)
movq %rbx, PCPU(RSP0)
- movl TD_TID(%rsi), %eax
movq %r8, PCPU(CURPCB)
- movl %eax, PCPU(CURTID)
movq %rsi, PCPU(CURTHREAD) /* into next thread */
testl $PCB_32BIT,PCB_FLAGS(%r8)
diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
index bed8b53..42858b3 100644
--- a/sys/amd64/amd64/genassym.c
+++ b/sys/amd64/amd64/genassym.c
@@ -194,7 +194,6 @@ ASSYM(PC_SCRATCH_RSP, offsetof(struct pcpu, pc_scratch_rsp));
ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap));
ASSYM(PC_TSSP, offsetof(struct pcpu, pc_tssp));
ASSYM(PC_RSP0, offsetof(struct pcpu, pc_rsp0));
-ASSYM(PC_CURTID, offsetof(struct pcpu, pc_curtid));
ASSYM(LA_VER, offsetof(struct LAPIC, version));
ASSYM(LA_TPR, offsetof(struct LAPIC, tpr));
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index a52ea51..7252386 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1179,7 +1179,6 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
PCPU_SET(prvspace, pc);
PCPU_SET(curthread, &thread0);
PCPU_SET(curpcb, thread0.td_pcb);
- PCPU_SET(curtid, thread0.td_tid);
PCPU_SET(tssp, &common_tss[0]);
/*
diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c
index bf15298..791bf09 100644
--- a/sys/i386/i386/genassym.c
+++ b/sys/i386/i386/genassym.c
@@ -199,7 +199,6 @@ ASSYM(PC_CURRENTLDT, offsetof(struct pcpu, pc_currentldt));
ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid));
ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap));
ASSYM(PC_PRIVATE_TSS, offsetof(struct pcpu, pc_private_tss));
-ASSYM(PC_CURTID, offsetof(struct pcpu, pc_curtid));
#ifdef DEV_APIC
ASSYM(LA_VER, offsetof(struct LAPIC, version));
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 16f2303..df3b5eb 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -2118,7 +2118,6 @@ init386(first)
PCPU_SET(prvspace, pc);
PCPU_SET(curthread, &thread0);
PCPU_SET(curpcb, thread0.td_pcb);
- PCPU_SET(curtid, thread0.td_tid);
/*
* Initialize mutexes.
diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s
index 5df5959..9002a81 100644
--- a/sys/i386/i386/swtch.s
+++ b/sys/i386/i386/swtch.s
@@ -247,7 +247,6 @@ sw1:
movl %edx, PCPU(CURPCB)
movl TD_TID(%ecx),%eax
movl %ecx, PCPU(CURTHREAD) /* into next thread */
- movl %eax, PCPU(CURTID)
/*
* Determine the LDT to use and load it if is the default one and
diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
index 2640278..6df3ce7 100644
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -193,13 +193,6 @@ static int umtx_pi_allocated;
SYSCTL_NODE(_debug, OID_AUTO, umtx, CTLFLAG_RW, 0, "umtx debug");
SYSCTL_INT(_debug_umtx, OID_AUTO, umtx_pi_allocated, CTLFLAG_RD,
&umtx_pi_allocated, 0, "Allocated umtx_pi");
-SYSCTL_DECL(_kern_threads);
-static int umtx_dflt_spins = 0;
-SYSCTL_INT(_kern_threads, OID_AUTO, umtx_dflt_spins, CTLFLAG_RW,
- &umtx_dflt_spins, 0, "default umtx spin count");
-static int umtx_max_spins = 3000;
-SYSCTL_INT(_kern_threads, OID_AUTO, umtx_max_spins, CTLFLAG_RW,
- &umtx_max_spins, 0, "max umtx spin count");
static void umtxq_sysinit(void *);
static void umtxq_hash(struct umtx_key *key);
@@ -1025,33 +1018,16 @@ _do_lock_normal(struct thread *td, struct umutex *m, uint32_t flags, int timo,
{
struct umtx_q *uq;
uint32_t owner, old, id;
-#ifdef SMP
- int spincount;
-#endif
int error = 0;
id = td->td_tid;
uq = td->td_umtxq;
-#ifdef SMP
- if (smp_cpus > 1) {
- spincount = fuword32(&m->m_spincount);
- if (spincount == 0)
- spincount = umtx_dflt_spins;
- if (spincount > umtx_max_spins)
- spincount = umtx_max_spins;
- } else
- spincount = 0;
-#endif
-
/*
* Care must be exercised when dealing with umtx structure. It
* can fault on any access.
*/
for (;;) {
-#ifdef SMP
-try_unowned:
-#endif
/*
* Try the uncontested case. This should be done in userland.
*/
@@ -1067,9 +1043,6 @@ try_unowned:
/* If no one owns it but it is contested try to acquire it. */
if (owner == UMUTEX_CONTESTED) {
-#ifdef SMP
-try_contested:
-#endif
owner = casuword32(&m->m_owner,
UMUTEX_CONTESTED, id | UMUTEX_CONTESTED);
@@ -1091,46 +1064,6 @@ try_contested:
if (try != 0)
return (EBUSY);
-#ifdef SMP
- if (spincount > 0 && (owner & ~UMUTEX_CONTESTED) != id) {
- int i, found = 0;
- struct pcpu *pcpu = NULL;
-
- /* Look for a cpu the owner is running on */
- for (i = 0; i < MAXCPU; i++) {
- if (CPU_ABSENT(i))
- continue;
- pcpu = pcpu_find(i);
- if ((owner & ~UMUTEX_CONTESTED) == pcpu->pc_curtid) {
- found = 1;
- break;
- }
- }
-
- if (__predict_false(!found))
- goto end_spin;
-
- while ((owner & ~UMUTEX_CONTESTED) == pcpu->pc_curtid &&
- (owner & ~UMUTEX_CONTESTED) != id) {
- if (--spincount <= 0)
- break;
- if ((td->td_flags &
- (TDF_NEEDRESCHED|TDF_ASTPENDING|TDF_NEEDSIGCHK)) ||
- P_SHOULDSTOP(td->td_proc))
- break;
- owner = fuword32(__DEVOLATILE(uint32_t *, &m->m_owner));
- if (owner == UMUTEX_UNOWNED)
- goto try_unowned;
- if (owner == UMUTEX_CONTESTED)
- goto try_contested;
- cpu_spinwait();
- }
- }
-end_spin:
- spincount = 0;
-
-#endif
-
/*
* If we caught a signal, we have retried and now
* exit immediately.
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index 1e415c3..b2fd628 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -74,7 +74,6 @@ struct pcpu {
PCPU_MD_FIELDS;
struct vmmeter pc_cnt; /* VM stats counters */
struct device *pc_device;
- lwpid_t pc_curtid;
};
SLIST_HEAD(cpuhead, pcpu);
diff --git a/sys/sys/umtx.h b/sys/sys/umtx.h
index eaea8f6..6631be7 100644
--- a/sys/sys/umtx.h
+++ b/sys/sys/umtx.h
@@ -57,8 +57,7 @@ struct umutex {
volatile __lwpid_t m_owner; /* Owner of the mutex */
uint32_t m_flags; /* Flags of the mutex */
uint32_t m_ceilings[2]; /* Priority protect ceiling */
- uint32_t m_spincount; /* Max spinning cycle */
- uint32_t m_spare[3];
+ uint32_t m_spare[4];
};
struct ucond {
OpenPOWER on IntegriCloud