Commit Graph

419 Commits

Author SHA1 Message Date
Jeff Roberson
5053d272c2 - Make the interactivity calculator decay faster.
- Make the pcpu estimator update faster.
2003-04-02 08:22:33 +00:00
Jeff Roberson
98c9b132d1 - I meant divide by two and not shift by two in SCHED_PRI_NHALF. 2003-04-02 08:21:24 +00:00
Jeff Roberson
245f3abfd5 - Add in support for KSEs with 0 slice values on the run queue. If we try
to select a KSE with a slice of 0 we will update its slice and insert it
   onto the next queue.
 - Pass the KSE instead of the ksegrp into sched_slice().  This more
   accurately reflects the behavior of the code.  Slices are granted to kses.
 - Add a function kseq_nice_min() which finds the smallest nice value
   assigned to the kseg of any KSE on the queue.
 - Rewrite the logic in sched_slice().  Add a large comment describing the
   new slice selection scheme.  To summarize, slices are assigned based on
   the nice value.  Priorities are still calculated based on the nice and
   interactivity of a process.  Slice sizes of 0 may be granted for KSEs
   whos nice is 20 or futher away from the lowest nice on the run queue.
   Other nice values are scaled across the range [min, min+20].  This fixes
   ULEs bad behavior with positively niced processes.
2003-04-02 06:46:43 +00:00
Jeff Roberson
e1f89c222b - Create a function sched_interact_score() which decides on the
interactivity of a kseg and assigns it a value of 0 through 100.
 - Use sched_interact_score() to determine the dynamic priority.
 - Define SCHED_CURR() in terms of sched_interact_score().
 - Adjust the maximum slice back down to 100ms.
 - Remove redundant clearing of ke_runq in sched_wakeup()
 - Clean up #defines and comment them.
2003-03-04 02:45:59 +00:00
Jeff Roberson
65c8760dbf - Shift the tick count by 10 and back around sched_pctcpu_update()
calculations.  Keep this changes local to the function so the tick count
   is in its natural form otherwise.  Previously 1000 was added each time
   a tick fired and we divided by 1000 when it was reported.  This is done
   to reduce rounding errors.
2003-03-03 05:29:09 +00:00
Jeff Roberson
a6ed41865b - In sched_add() special case PRI_TIMESHARE and PRI_ITHD|PRI_REALTIME. We
always place ITHD & REALTIME threads on the current queue of the current
   cpu.  Prior to this change an interrupt thread would only ever run on one
   cpu.
2003-03-03 04:28:07 +00:00
Jeff Roberson
f1e8dc4a3b - Refrain from setting the td_priority in sched_wakeup(). It will be reset
before we return to user space.
2003-03-03 04:11:40 +00:00
Julian Elischer
ac2e415327 Change the process flags P_KSES to be P_THREADED.
This is just a cosmetic change but I've been meaning to do it for about a year.
2003-02-27 02:05:19 +00:00
Julian Elischer
4a338afd7a Move a bunch of flags from the KSE to the thread.
I was in two minds as to where to put them in the first case..
I should have listenned to the other mind.

Submitted by:	 parts by davidxu@
Reviewed by:	jeff@ mini@
2003-02-17 09:55:10 +00:00
Jeff Roberson
783caefbbf - Enable STRICT_RESCHED until code that dynamically decides on resched
strictness based on the current workload is finished.
2003-02-10 14:11:23 +00:00
Jeff Roberson
407b015791 - Add a new variable 'kg_runtime' that tracks the amount of time we've run.
- Use the ratio of kg_runtime / kg_slptime to determine our dynamic priority.
 - Scale kg_runtime and kg_slptime back when the sum of the two exceeds
   SCHED_SLP_RUN_MAX.  This allows us to slowly forget old behavior.
 - Scale back the runtime and slptime in fork so that the new process has the
   same ratio but much less accumulated time.  This causes new behavior to be
   noticed more quickly.
2003-02-10 14:03:45 +00:00
Jeff Roberson
5d7ef00cfe - Make some context switches conditional on SCHED_STRICT_RESCHED. This may
have some negative effect on interactivity but it yields great perf. gains.
   This also brings the conditions under which ULE context switches inline
   with SCHED_4BSD.
 - Define some new kseq_* functions for manipulating the run queue.
 - Add a new kseq member ksq_rslices and ksq_bload.  rslices is the sum of
   the slices of runnable kses.  This will be used for push load balance
   decisions.  bload is the number of threads blocked waiting on IO.
2003-02-03 05:30:07 +00:00
Jeff Roberson
cd6e33df1c - Stop abusing oncpu for our cpu binding. Define a scheduler local element
in the kse datastructure called ke_cpu.  This is the cpu which we are
   currently bound to.  Some flags may be added later to support hard binding.
2003-02-03 02:26:28 +00:00
Scott Long
7121cce58a Use hz if stathz is zero. Adopted from sched_4bsd. 2003-02-02 08:24:32 +00:00
Jeff Roberson
0a016a05a4 - Use ksq_load as the authoritive count of kses on the pair of kseqs for
sched_runnable() et all.
 - Remove some dead code in sched_clock().
 - Define two macros KSEQ_SELF() and KSEQ_CPU() for getting the kseq of the
   current cpu or some alternate cpu.
 - Start introducing kseq_() functions, such as kseq_choose() and kseq_setup().
2003-01-29 07:00:51 +00:00
Jeff Roberson
bf857e69a2 - Remove debugging code that didn't work on UP. 2003-01-29 00:26:47 +00:00
Jeff Roberson
d465fb9589 - Allow idle's pctcpu time to be calculated. 2003-01-28 09:30:17 +00:00
Jeff Roberson
c9f25d8f92 - Fix the ksq_load calculation. It now reflects the number of entries on the
run queue for each cpu.
 - Introduce kse stealing into the sched_choose() code.  This helps balance
   cpus better in cases where process turnover is high.  This implementation
   is fairly trivial and will likely be only a temporary measure until
   something more sophisticated has been written.
2003-01-28 09:28:20 +00:00
Jeff Roberson
35e6168fcd - Add the ule scheduler. This is intended to be a general purpose process
scheduler with many SMP benefits.  It is still very experimental and should
   be used only in test environments.
2003-01-26 05:23:15 +00:00