Commit Graph

23 Commits

Author SHA1 Message Date
ad feb4783fdf Replace use of CACHE_LINE_SIZE in some obvious places. 2008-03-27 18:30:15 +00:00
rmind ca99f7a582 - Perform periodical balancing of CPU-bound threads, which tends to
never sleep.  Should fix PR/37245 by <yamt>.
- Fix a regression - dissalow catching of bound threads.  Also, allow
  migration of non-bound kthreads, this restriction seems pointless.
- Few micro-optimisations, misc.
2008-03-11 18:18:49 +00:00
martin d8788e7fd7 Use cpu index instead of the machine dependend, not very expressive
cpuid when naming user-visible kernel entities.
2008-03-10 22:20:14 +00:00
ad 60c1b8843d Make schedstate_percpu::spc_lwplock an exernally allocated item. Remove
the hacks in sparc/cpu.c to reinitialize it. This should be in its own
cache line but that's another change.
2008-02-14 14:26:57 +00:00
rmind fb513e5cf5 - sched_cpuattach: fix address calculation, use roundup2();
Fixes the problems with systems having > 2GB of memory;
  From <drochner>, thanks for catching this!
- Convert pool to pool-cache;
- Adjust copyright while here;
2008-01-31 00:46:55 +00:00
rmind 855e8f35f6 sched_slept: Revert inclusion of PRI_HIGHEST_TS into the range.
Reported by <drochner>.
2008-01-15 18:41:37 +00:00
rmind 78e6c5f3f6 Remove PRI_DEFAULT, which was left previously..
Note: nice(1) is only for historical purposes, schedctl(8) should be used.
2008-01-15 16:14:19 +00:00
rmind f5c269bd3e - Estimate cache-hotness in all states, except LSIDL;
- Include PRI_HIGHEST_TS value into the increasion range,
  it was missed previously by mistake;
- More KASSERTs to handle invalid priorities of threads;
- Remove PRI_DEFAULT;
- Misc;
2008-01-15 04:16:27 +00:00
rmind 5c71a4d49f Implementation of processor-sets, affinity and POSIX real-time extensions.
Add schedctl(8) - a program to control scheduling of processes and threads.

Notes:
- This is supported only by SCHED_M2;
- Migration of LWP mechanism will be revisited;

Proposed on: <tech-kern>. Reviewed by: <ad>.
2008-01-15 03:37:10 +00:00
ad 5b42fe1209 KM_NOSLEEP -> KM_SLEEP for clarity. 2007-12-21 12:05:39 +00:00
ad 598ab03ad0 Match the docs: MUTEX_DRIVER/SPIN are now only for porting code written
for Solaris.
2007-12-05 07:06:50 +00:00
rmind c75dc3277a Unify the license: All rights reserved.
No functional change.
2007-11-28 19:30:55 +00:00
rmind b68c6d084f Modifications for the recent vmlocking changes:
- Re-enqueue the thread when priority changes and it is in LSRUN state;
- Handle the __HAVE_FAST_SOFTINTS case in sched_curcpu_runnable_p();
- Few minor changes;
2007-11-07 03:07:14 +00:00
ad d831186d55 Merge scheduler changes from the vmlocking branch. All discussed on
tech-kern:

- Invert priority space so that zero is the lowest priority. Rearrange
  number and type of priority levels into bands. Add new bands like
  'kernel real time'.
- Ignore the priority level passed to tsleep. Compute priority for
  sleep dynamically.
- For SCHED_4BSD, make priority adjustment per-LWP, not per-process.
2007-11-06 00:42:39 +00:00
rmind 823cbaa23b Fix sysctl_createv "pasto" in previous. 2007-11-04 14:15:34 +00:00
rmind fc4b6513fa - sched_setup: use ilog2() for min_catch, which fixes the case when count
of CPU is non-power of 2.  Fixes PR/37244.
- sched_enqueue: initialize sl_lrtime, when it is zero (new thread).
  Part of PR/37245.
- Fix the mints/maxts sysctl helpers, use mstohz() for the checks.  Also,
  I meant miliseconds, not microseconds.  Found by <bjs>.
2007-11-04 12:36:01 +00:00
rmind 7c0340a739 - Migrate all threads when the state of CPU is changed to offline;
- Fix inverted logic with r_mcount in M2;
- setrunnable: perform sched_takecpu() when making the LWP runnable;
- setrunnable: l_mutex cannot be spc_mutex here;

This makes cpuctl(8) work with SCHED_M2.

OK by <ad>.
2007-11-04 11:43:07 +00:00
ad a2a3828545 machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h 2007-10-19 11:59:34 +00:00
yamt 2171d72e8b fix typos in a comment. 2007-10-14 13:56:32 +00:00
yamt 2ea5c00ae9 sched_wakeup: remove a wrong assertion. 2007-10-13 12:05:32 +00:00
rmind a416e41211 sched_catchlwp: Estimate the pointers of CPU structures, not spc_mutex'es,
when double-locking the runqueues.
2007-10-10 22:21:17 +00:00
rmind 03d447f116 sched_tick: There is no need to re-schedule in a case when
CURCPU_IDLE_P() is true.  Simplify a little bit.

OK by <ad>.
2007-10-10 21:24:53 +00:00
rmind a21233e46b Import of SCHED_M2 - the implementation of new scheduler, which is based
on the original approach of SVR4 with some inspirations about balancing
and migration from Solaris.  It implements per-CPU runqueues, provides a
real-time (RT) and time-sharing (TS) queues, ready to support a POSIX
real-time extensions, and also prepared for the support of CPU affinity.

The following lines in the kernel config enables the SCHED_M2:

no options SCHED_4BSD
options SCHED_M2

The scheduler seems to be stable.  Further work will come soon.

http://mail-index.netbsd.org/tech-kern/2007/10/04/0001.html
http://www.netbsd.org/~rmind/m2/mysql_bench_ro_4x_local.png
Thanks <ad> for the benchmarks!
2007-10-09 19:00:13 +00:00