Support and switch to the ULE scheduler:

o  Implement IPI_PREEMPT,
o  Set td_lock for the thread being switched out,
o  For ULE & SMP, loop while td_lock points to blocked_lock for
   the thread being switched in,
o  Enable ULE by default in GENERIC and SKI,
This commit is contained in:
Marcel Moolenaar 2008-04-15 05:02:42 +00:00
parent a0a16e977c
commit 495168ba8d
5 changed files with 19 additions and 4 deletions

View File

@ -48,7 +48,7 @@ options NFSLOCKD # Network Lock Manager
options NFS_ROOT # NFS usable as root device
options PROCFS # Process filesystem (/proc)
options PSEUDOFS # Pseudo-filesystem framework
options SCHED_4BSD # 4BSD scheduler
options SCHED_ULE # ULE scheduler
options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI
options SCTP # Stream Control Transmission Protocol
options SMP # Symmetric Multi-Processor support

View File

@ -35,8 +35,8 @@ options KTRACE # ktrace(1) syscall trace support
options MD_ROOT # MD usable as root device
options PROCFS # Process filesystem (/proc)
options PSEUDOFS # Pseudo-filesystem framework
options SCHED_4BSD # 4BSD scheduler
#options SCHED_ULE # ULE scheduler
#options SCHED_4BSD # 4BSD scheduler
options SCHED_ULE # ULE scheduler
options SKI # Include SKI support code
options SOFTUPDATES # Enable FFS soft updates support
options SYSVMSG # SYSV-style message queues

View File

@ -47,6 +47,7 @@
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
@ -241,6 +242,9 @@ interrupt(struct trapframe *tf)
} else if (vector == ipi_vector[IPI_TEST]) {
CTR1(KTR_SMP, "IPI_TEST, cpuid=%d", PCPU_GET(cpuid));
mp_ipi_test++;
} else if (vector == ipi_vector[IPI_PREEMPT]) {
CTR1(KTR_SMP, "IPI_PREEMPT, cpuid=%d", PCPU_GET(cpuid));
sched_preempt(curthread);
#endif
} else {
ints[PCPU_GET(cpuid)]++;

View File

@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include "opt_ddb.h"
#include "opt_kstack_pages.h"
#include "opt_msgbuf.h"
#include "opt_sched.h"
#include <sys/param.h>
#include <sys/proc.h>
@ -370,6 +371,12 @@ cpu_switch(struct thread *old, struct thread *new, struct mtx *mtx)
if (PCPU_GET(fpcurthread) == old)
old->td_frame->tf_special.psr |= IA64_PSR_DFH;
if (!savectx(oldpcb)) {
old->td_lock = mtx;
#if defined(SCHED_ULE) && defined(SMP)
/* td_lock is volatile */
while (new->td_lock == &blocked_lock)
;
#endif
newpcb = new->td_pcb;
oldpcb->pcb_current_pmap =
pmap_switch(newpcb->pcb_current_pmap);
@ -890,12 +897,16 @@ DELAY(int n)
{
u_int64_t start, end, now;
sched_pin();
start = ia64_get_itc();
end = start + (itc_frequency * n) / 1000000;
/* printf("DELAY from 0x%lx to 0x%lx\n", start, end); */
do {
now = ia64_get_itc();
} while (now < end || (now > start && end < start));
sched_unpin();
}
/*

View File

@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$");
#include <machine/cpu.h>
#include <machine/smp.h>
#if !defined(__i386__) && !defined(__amd64__) && !defined(__powerpc__) && !defined(__arm__)
#if defined(__sparc64__) || defined(__mips__)
#error "This architecture is not currently compatible with ULE"
#endif