freebsd-nq/sys/amd64/include
John Baldwin 0c0b25ae91 Implement preemption of kernel threads natively in the scheduler rather
than as one-off hacks in various other parts of the kernel:
- Add a function maybe_preempt() that is called from sched_add() to
  determine if a thread about to be added to a run queue should be
  preempted to directly.  If it is not safe to preempt or if the new
  thread does not have a high enough priority, then the function returns
  false and sched_add() adds the thread to the run queue.  If the thread
  should be preempted to but the current thread is in a nested critical
  section, then the flag TDF_OWEPREEMPT is set and the thread is added
  to the run queue.  Otherwise, mi_switch() is called immediately and the
  thread is never added to the run queue since it is switch to directly.
  When exiting an outermost critical section, if TDF_OWEPREEMPT is set,
  then clear it and call mi_switch() to perform the deferred preemption.
- Remove explicit preemption from ithread_schedule() as calling
  setrunqueue() now does all the correct work.  This also removes the
  do_switch argument from ithread_schedule().
- Do not use the manual preemption code in mtx_unlock if the architecture
  supports native preemption.
- Don't call mi_switch() in a loop during shutdown to give ithreads a
  chance to run if the architecture supports native preemption since
  the ithreads will just preempt DELAY().
- Don't call mi_switch() from the page zeroing idle thread for
  architectures that support native preemption as it is unnecessary.
- Native preemption is enabled on the same archs that supported ithread
  preemption, namely alpha, i386, and amd64.

This change should largely be a NOP for the default case as committed
except that we will do fewer context switches in a few cases and will
avoid the run queues completely when preempting.

Approved by:	scottl (with his re@ hat)
2004-07-02 20:21:44 +00:00
..
pc - Use the correct devclass name ("acpi" vs "ACPI") to detect if acpi0 is 2004-06-10 20:43:04 +00:00
_inttypes.h
_limits.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
_stdint.h <stdint.h> should define WINT_M{AX,IN} independent from whether WCHAR_MIN is 2004-05-18 16:04:57 +00:00
_types.h Introduce the cpumask_t type. The purpose of the type is to create a 2004-03-20 20:41:40 +00:00
acpica_machdep.h Add an MI implementation of the ACPI global lock routines and retire the 2004-05-05 20:04:14 +00:00
apicreg.h MFi386: remove APIC_IRQ* defines that are no longer used. 2003-12-11 02:48:25 +00:00
apicvar.h Kill the LAZYPMAP ifdefs. While they worked, they didn't do anything 2004-05-16 22:11:50 +00:00
asm.h Argh. Add the mini-stack-frame back in for mcount's benefit for syscall 2004-06-10 22:02:26 +00:00
asmacros.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
atomic.h Cosmetic and/or trivial sync up with i386. 2003-11-21 03:02:00 +00:00
bus_amd64.h
bus_dma.h Cosmetic and/or trivial sync up with i386. 2003-11-21 03:02:00 +00:00
bus_memio.h
bus_pio.h
bus.h
clock.h
cpu.h Backed out previous commit. Blind substitution of dev_t by `struct cdev *' 2004-06-20 03:52:50 +00:00
cpufunc.h MFi386: move rss() from db_interface.c to cpufunc.h 2004-04-07 00:41:05 +00:00
cputypes.h MFi386: move cpu_nameclass struct next to its only consumer 2004-06-03 20:18:15 +00:00
critical.h Fix syntax errors and wrong function prototypes in several MD header 2004-03-05 09:19:59 +00:00
db_machdep.h
elf.h
endian.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
exec.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
float.h Hide FLT_EVAL_METHOD and DECIMAL_DIG in pre-C99 compilation 2004-04-25 02:36:29 +00:00
floatingpoint.h
fpu.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
frame.h Remove advertising clause from University of California Regent's license, 2004-04-05 23:55:14 +00:00
ieeefp.h
in_cksum.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
intr_machdep.h MFi386: numerous interrupt and acpi updates 2004-05-16 20:30:47 +00:00
legacyvar.h MFi386: numerous interrupt and acpi updates 2004-05-16 20:30:47 +00:00
limits.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
md_var.h Remove atdevbase and replace it's remaining uses with direct references to 2004-06-10 20:31:00 +00:00
metadata.h
mptable.h
mutex.h Kill the ASM versions of the mtx_lock_spin and friends. They were never 2003-12-06 23:17:18 +00:00
param.h Implement preemption of kernel threads natively in the scheduler rather 2004-07-02 20:21:44 +00:00
pcb_ext.h
pcb.h Checkpoint some of what I was starting to tinker with for having some 2004-05-16 22:43:57 +00:00
pci_cfgreg.h MFi386: nuke pci_cfgintr 2004-03-13 19:19:13 +00:00
pcpu.h
pmap.h Include <sys/_lock.h>'s prerequisite <sys/queue.h> before including the 2004-06-19 14:58:35 +00:00
proc.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
profile.h Make profiling work for varargs functions.. %al is an additional argument 2004-06-10 22:00:58 +00:00
psl.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
ptrace.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
reg.h Remove advertising clause from University of California Regent's license, 2004-04-05 23:55:14 +00:00
reloc.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
resource.h
runq.h Reconfigure the runq macros to use the 64 bit ffs/bsf routines instead 2003-12-06 23:24:18 +00:00
segments.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
setjmp.h
sf_buf.h Simplify the sf_buf implementation. In short, make it a trivial veneer 2004-04-18 05:36:37 +00:00
sigframe.h
signal.h Remove advertising clause from University of California Regent's license, 2004-04-05 23:55:14 +00:00
smp.h Kill the LAZYPMAP ifdefs. While they worked, they didn't do anything 2004-05-16 22:11:50 +00:00
specialreg.h Initial PG_NX support (no-execute page bit) 2004-06-08 01:02:52 +00:00
stdarg.h
sysarch.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
trap.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
tss.h Remove advertising clause from University of California Regent's license, 2004-04-05 21:29:41 +00:00
ucontext.h
varargs.h
vmparam.h Increase VM_KMEM_SIZE_MAX from 200MB to 400MB. 2003-12-07 04:51:04 +00:00