Commit graph

643 commits

Author SHA1 Message Date
Tomas Hruby c554aef0e1 SMP - BKL statistics
- pressing 'B' on the serial cnsole prints statistics for BKL per cpu.

- 'b' resets the counters

- it presents number of cycles each CPU spends in kernel, how many
  cycyles it spends spinning while waiting for the BKL

- it shows optimistic estimation in how many cases we get the lock
  immediately without spinning. As the test is not atomic the lock may
  be already held by some other cpu before we actually try to acquire
  it.
2010-09-15 14:10:37 +00:00
Tomas Hruby 93b9873a56 SMP - Free PDE slots are split among CPU
- cross-address space copies use these slots to map user memory for
  kernel. This avoid any collisions between CPUs

- well, we only have a single CPU running at a time, this is just to
  be safe for the future
2010-09-15 14:10:36 +00:00
Tomas Hruby 1e273f640e SMP - Scheduler can assign process to a cpu
- machine information contains the number of cpus and the bsp id

- a dummy SMP scheduler which keeps all system processes on BSP and
  all other process on APs. The scheduler remembers how many processes
  are assigned to each CPU and always picks the one with the least
  processes for a new process.
2010-09-15 14:10:33 +00:00
Tomas Hruby 9e12630d75 SMP - APs are fully enabled
- apic_send_ipi() to send inter-processor interrupts (IPIs)

- APIC IPI schedule and halt handlers to signal x-cpu that a cpu shold
  reschedule or halt

- various little changes to let APs run

- no processes are scheduled at the APs and therefore they are idle
  except being interrupted by a timer time to time
2010-09-15 14:10:30 +00:00
Tomas Hruby d37b7ebc0b SMP - CPU local cycles accounting
- tsc_ctr_switch is made cpu local

- although an x86 specific variable it must be declared globaly as the
  cpulocal implementation does not allow otherwise
2010-09-15 14:10:27 +00:00
Tomas Hruby 67f039540c SMP - proc_ptr and bill_ptr initialization
- they should point somewhere
2010-09-15 14:10:24 +00:00
Tomas Hruby 865e21b884 SMP - CPU local idle stub
- each CPU has its own pseudo idle process and its structure

- idle cycles accounting is agregated when exporting to userspace
2010-09-15 14:10:21 +00:00
Tomas Hruby fac5fbfdbf SMP - CPU local run queues
- each CPU has its own runqueues

- processes on BSP are put on the runqueues later after a switch to
  the final stack when cpuid works to avoid special cases

- enqueue() and dequeue() use the run queues of the cpu the process is
  assigned to

- pick_proc() uses the local run queues

- printing of per-CPU run queues ('2') on serial console
2010-09-15 14:10:18 +00:00
Tomas Hruby ad73a4f50c SMP - CPU and CPU mask for processes
- each process has associated information about the cpu it is currently
  scheduled on and the mask of cpus it is allowed to use.
2010-09-15 14:10:16 +00:00
Tomas Hruby 9b6d66c787 SMP - BSP waits until the APs finish their booting
- APs configure local timers

- while configuring local APIC timer the CPUs fiddle with the interrupt
  handlers. As the interrupt table is shared the BSP must not run
2010-09-15 14:10:12 +00:00
Tomas Hruby b7aed08e65 SMP - Only a single APIC timer handler
- bsp_timer_int_handler() and ap_timer_int_handler() unified into
  timer_int_handler()

- global realtime updated only on BSP
2010-09-15 14:10:09 +00:00
Tomas Hruby 85cca7096f SMP - The slave CPUs turn paging on
- APs wait until BSP turns paging on, it is not possible to safely
  execute any code on APs until we can turn paging on as well as it
  must be done synchronously everywhere

- APs turn paging on but do not continue and wait
2010-09-15 14:10:07 +00:00
Tomas Hruby 6aa26565e6 SMP - Big kernel lock (BKL)
- to isolate execution inside kernel we use a big kernel lock
  implemented as a spinlock

- the lock is acquired asap after entering kernel mode and released as
  late as possible. Only one CPU as a time can execute the core kernel
  code

- measurement son real hw show that the overhead of this lock is close
  to 0% of kernel time for the currnet system

- the overhead of this lock may be as high as 45% of kernel time in
  virtual machines depending on the ratio between physical CPUs
  available and emulated CPUs. The performance degradation is
  significant
2010-09-15 14:10:03 +00:00
Tomas Hruby a42ab504a0 SMP - Kernel is loaded above 1M by default
- the 16-bit trampoline must be within the first megabyte of physical
  memory thus the smp trampoline is copied explicitly below 1M
2010-09-15 14:10:00 +00:00
Tomas Hruby 62c666566e SMP - We boot APs
- kernel detects CPUs by searching ACPI tables for local apic nodes

- each CPU has its own TSS that points to its own stack. All cpus boot
  on the same boot stack (in sequence) but switch to its private stack
  as soon as they can.

- final booting code in main() placed in bsp_finish_booting() which is
  executed only after the BSP switches to its final stack

- apic functions to send startup interrupts

- assembler functions to handle CPU features not needed for single cpu
  mode like memory barries, HT detection etc.

- new files kernel/smp.[ch], kernel/arch/i386/arch_smp.c and
  kernel/arch/i386/include/arch_smp.h

- 16-bit trampoline code for the APs. It is executed by each AP after
  receiving startup IPIs it brings up the CPUs to 32bit mode and let
  them spin in an infinite loop so they don't do any damage.

- implementation of kernel spinlock

- CONFIG_SMP and CONFIG_MAX_CPUS set by the build system
2010-09-15 14:09:52 +00:00
Tomas Hruby 13a0d5fa5e SMP - Cpu local variables
- most global variables carry information which is specific to the
  local CPU and each CPU must have its own copy

- cpu local variable must be declared in cpulocal.h between
  DECLARE_CPULOCAL_START and DECLARE_CPULOCAL_END markers using
  DECLARE_CPULOCAL macro

- to access the cpu local data the provided macros must be used

	get_cpu_var(cpu, name)
	get_cpu_var_ptr(cpu, name)

	get_cpulocal_var(name)
	get_cpulocal_var_ptr(name)

- using this macros makes future changes in the implementation
  possible

- switching to ELF will make the declaration of cpu local data much
  simpler, e.g.

  CPULOCAL int blah;

  anywhere in the kernel source code
2010-09-15 14:09:46 +00:00
Tomas Hruby 2a2a19e542 proc_init()
- code that initializes proc.c structures removed from main() and placed in
  proc_init() function
2010-09-15 14:09:43 +00:00
Tomas Hruby ce4fd0c0fb Enable paging - some more code reshuffling 2010-09-15 14:09:41 +00:00
Tomas Hruby 6c3b981cd6 arch proto.h renamed to arch_proto.h
- the file moved to the arch include dir
2010-09-15 14:09:36 +00:00
Ben Gras 2065c9982b include - minor compile fixes (including <ansi.h> in files that use it)
workaround for kernel/debug.h that causes <ansi.h> to be included in mpx.S
indirectly.
2010-09-15 08:47:10 +00:00
Ben Gras eaa37fd21c make, lib changes to make gcc/clang format libraries in /usr/lib instead of /usr/gnu/lib. 2010-09-13 16:37:02 +00:00
Tomas Hruby e6ebac015d APIC mode uses IO APICs
- kernel turns on IO APICs if no_apic is _not_ set or is equal 0

- pci driver must use the acpi driver to setup IRQ routing otherwise
  the system cannot work correctly except systems like KVM that use
  only legacy (E)ISA IRQs 0-15
2010-09-07 07:18:11 +00:00
Tomas Hruby 2440ffae49 Kernel exports DSDP and apic_enabled in machine structure
- kernel exports DSDP (the root pointer where ACPI parsing starts) and
  apic_enabled in the machine structure.

- ACPI driver uses DSDP to locate ACPI in memory. acpi_enabled tell
  PCI driver to query ACPI for IRQ routing information.
2010-09-02 15:43:56 +00:00
Tomas Hruby 344e9221ec Kernel supports up to 64 IRQs
- enough for 2 io apics (usually with 24 pins)
2010-09-02 15:43:54 +00:00
Tomas Hruby 45badf4c05 ACPI in kernel
- the ability for kernel to use ACPI tables to detect IO APICs. It is
  the bare minimum the kernel needs to know about ACPI tables.

- it will be used to find out about processors as the MPS tables are
  deprecated by ACPI and not all vendorsprovide them.
2010-09-02 15:43:51 +00:00
Ben Gras b3c3a1cb1e gcc compiles - add -fno-builtin so that gcc optimisations don't break things.
- kernel compile was broken with gcc as putchar() was added by gcc in
    stacktrace.c
  - add -fno-builtin everywhere to avoid such problems in the future
  - -fno-builtin in kernel now redundant
2010-08-31 16:42:44 +00:00
Erik van der Kouwe 1f2054c89c Shutdown changes for multiboot: CTRL-ALT-DEL resets, panic halts 2010-08-30 19:01:58 +00:00
Erik van der Kouwe 50ca7f7f8f Zero out to three stack dwords to fix boot errors 2010-08-24 12:51:11 +00:00
Arun Thomas de231a713e Move MIN() and MAX() macros to sys/params.h 2010-08-21 13:10:41 +00:00
Erik van der Kouwe b9f5e50421 Provide boot image process main functions with a full parameter list, so that bad things don't heppen when using getenv 2010-08-20 11:07:16 +00:00
Arun Thomas 9a21d1a2fd Macros for symbols used in both ASM and C
-The macros take care of prepending the leading underscore when
 necessary.
2010-08-17 16:44:07 +00:00
Tomas Hruby f7ef192c02 Fixed warning noreturn function returns in arch_system.c 2010-08-06 12:48:26 +00:00
Tomas Hruby 58654acf08 both ack and gcc can compile klib16.S 2010-08-06 12:46:44 +00:00
Tomas Hruby ac9a7f47bd Missing prototype in pre_init.c
- gcc does not like it
2010-08-06 12:26:26 +00:00
Erik van der Kouwe 25397ef756 Deal all shutdown cases with multiboot as either reset or poweroff depending on their type (contributed by Feiran 'Fam' Zheng) 2010-08-02 14:41:45 +00:00
Erik van der Kouwe ebec792700 Display fallback message in case poweroff fails (contributed by Feiran 'Fam' Zheng) 2010-08-02 14:40:26 +00:00
Ben Gras b9cea27497 kernel: deadlock test with endpoints instead of slot numbers, slightly cleaner 2010-07-28 14:14:06 +00:00
Erik van der Kouwe df0ba02a38 Multiboot support (contributed by Feiran "Fam" Zheng);
keep in mind that GRUB needs to be patched to read MFS for now;
use /boot/image_latest to boot the last compiled image in GRUB
2010-07-23 14:24:34 +00:00
Erik van der Kouwe f389ad2655 Move sensitive instructions from libc into kernel 2010-07-23 07:12:47 +00:00
Ben Gras fe343bb002 Make kernel ipc log scripts work for separate ${.OBJDIR}.
contributed by Antoine Leca.
2010-07-22 22:04:37 +00:00
Cristiano Giuffrida 03bb1e5750 Don't panic so easily on unexpected pagefault. 2010-07-20 23:51:34 +00:00
Cristiano Giuffrida 0d984b36ef Get rid of static spare pages after VM startup. 2010-07-20 21:59:27 +00:00
Ben Gras 7f343ed574 kernel: clear MF_CONTEXT_SET on kernel exit. 2010-07-20 17:13:44 +00:00
Ben Gras c0074d3aa9 kernel: fix case of EAX getting clobbered after sigreturn. 2010-07-20 17:10:09 +00:00
Ben Gras e0701109ca kernel: make loading kernel in 2nd chunk of memory (at 1MB) the default.
(indicated by flags hardcoded in kernel that the boot monitor
interprets.)
2010-07-19 16:33:49 +00:00
Ben Gras b05c989298 kernel - prettier output for ipc errors, call names instead of trap numbers 2010-07-16 15:36:29 +00:00
Cristiano Giuffrida 20101b3bab Remove patch leftovers. 2010-07-13 22:40:14 +00:00
Cristiano Giuffrida f8a8ea0a79 Dynamic configuration in system.conf for boot system services. 2010-07-13 21:11:44 +00:00
Cristiano Giuffrida 8cedace2f5 Scheduling parameters out of the kernel. 2010-07-13 15:30:17 +00:00
Ben Gras 12e9303297 kernel: compile with -mi386 under gcc/clang to not generate SSE code in-kernel. 2010-07-12 10:11:50 +00:00
Cristiano Giuffrida 8427d774b6 RS live update support. 2010-07-09 18:29:04 +00:00
Cristiano Giuffrida 1f8dbed029 RS crash recovery support. 2010-07-06 22:05:21 +00:00
Ben Gras e920c1e1df kernel: fix main prototype 2010-07-06 12:14:59 +00:00
Ben Gras f6f814cb02 include, kernel: minor fixes to make compiling and linking work with clang.
(fixing warnings)
2010-07-06 11:59:19 +00:00
Kees van Reeuwijk 0cfdb11450 Repair errors and warnings flagged by llvm. 2010-07-06 11:29:23 +00:00
Ben Gras 42399159da kernel: these asserts from r7657 are not reasonable
will fire if copy needs more than one try, which is legit.
2010-07-05 17:45:16 +00:00
Ben Gras 545054c608 kernel: use MF_KCALL_RESUME instead of RTS_VMREQUEST for memcopy retry.
solves tracker item 499, submitted by Roman Ignatov.
2010-07-04 23:09:24 +00:00
Tomas Hruby 97eb470bee Fix 2010-07-01 12:31:53 +00:00
Tomas Hruby 7920d48156 FPU cleanup
- last reference to MF_USED_FPU removed

- proc_used_fpu() used to test for MF_FPU_INITIALIZED
2010-07-01 12:23:25 +00:00
Erik van der Kouwe 23284ee7bd User-space scheduling for system processes 2010-07-01 08:32:33 +00:00
Cristiano Giuffrida 180358ffb4 Give RS a page table. 2010-06-28 22:07:49 +00:00
Cristiano Giuffrida 06700d05d1 Give RS a page table. 2010-06-28 21:53:37 +00:00
Ben Gras 8379b08845 library function to retrieve kernel proc table and sanity check it 2010-06-28 11:05:15 +00:00
Tomas Hruby 67fa273d00 MF_REPLY_PEND should be removed when sendrec finishes 2010-06-28 08:32:49 +00:00
Kees van Reeuwijk 5eb6f6e922 Fixed a type declaration inconsistency. 2010-06-26 21:13:36 +00:00
Arun Thomas c0c8d25799 Rename mkfiles from minix.*.mk to bsd.*.mk
Makes things easier for pkgsrc
2010-06-25 18:29:09 +00:00
Erik van der Kouwe fe07e7c984 Optional IPC logging 2010-06-24 13:31:40 +00:00
Ben Gras b3a0a2d86f kernel: don't initialize catch_pagefaults at the extern declaration. 2010-06-24 12:23:23 +00:00
Tomas Hruby 76708e9bf4 mini_receive() clean up
- for better readability xpp is substitued by sender

- makes sure that the dequeued sender has p_q_link == NULL and that
  this condition holds when enqueuing the sender again. This is a
  sanity check to make sure that the new sender is not enqueued
  already

- Before this change the dequeued sender's p_q_link may not be NULL
  and it was only set to NULL when enqueued again
2010-06-23 10:36:19 +00:00
Tomas Hruby 6bc21b6992 Cycle counters zeroed after fork for the child 2010-06-18 14:01:34 +00:00
Tomas Hruby 360de619c0 No linear addresses in message delivery
- removes p_delivermsg_lin item from the process structure and code
  related to it

- as the send part, the receive does not need to use the
  PHYS_COPY_CATCH() and umap_local() couple.  

- The address space of the target process is installed before
  delivermsg() is called.

- unlike the linear address, the virtual address does not change when
  paging is turned on nor after fork().
2010-06-11 08:16:10 +00:00
Ben Gras a6e357da22 kernel: fix assert condition after a caught in-kernel pagefault 2010-06-09 10:59:57 +00:00
Kees van Reeuwijk 826b9590f2 More endpoint_t correctness.
More const correctness.
Other code cleanup.
2010-06-08 14:09:18 +00:00
Arun Thomas 4c10a31440 Remove legacy MM, FS, and FS_PROC_NR macros 2010-06-08 13:58:01 +00:00
Erik van der Kouwe 7bd7946346 Remove redundant macro cproc_addr 2010-06-08 13:38:44 +00:00
Erik van der Kouwe 78186ee5f5 Add endpoint checks in scheduling kernel calls 2010-06-08 12:04:21 +00:00
Ben Gras a09a8d4f3e kernel: fix for vm_init that triggered assert(ptproc == newptproc)
- zero cr3 in vm_init() to avoid switch_address_space() not doing anything.

 - add vm_stop() to disable paging on shutdown.
2010-06-07 22:21:45 +00:00
Tomas Hruby cbc9586c13 Lazy FPU
- FPU context is stored only if conflict between 2 FPU users or while
  exporting context of a process to userspace while it is the active
  user of FPU

- FPU has its owner (fpu_owner) which points to the process whose
  state is currently loaded in FPU

- the FPU exception is only turned on when scheduling a process which
  is not the owner of FPU

- FPU state is restored for the process that generated the FPU
  exception. This process runs immediately without letting scheduler
  to pick a new process to resolve the FPU conflict asap, to minimize
  the FPU thrashing and FPU exception hadler execution

- faster all non-FPU-exception kernel entries as FPU state is not
  checked nor saved

- removed MF_USED_FPU flag, only MF_FPU_INITIALIZED remains to signal
  that a process has used FPU in the past
2010-06-07 07:43:17 +00:00
Cristiano Giuffrida a53514d4a9 Fix range checking in safecopy. 2010-06-04 18:05:38 +00:00
Tomas Hruby f28acecb78 Removed a buggy assert unintentionally commted in r7044 2010-06-04 10:54:43 +00:00
Ben Gras 2f892aca91 kernel fpu context switching: fix race condition
There seems to have been a broken assumption in the fpu context
restoring code.  It restores the context of the running process, without
guarantee that the current process is the one that will be scheduled.
This caused fpu saving for a different process to be triggered without
fpu hardware being enabled, causing an fpu exception in the kernel. This
practically only shows up with DEBUG_RACE on. Fix my thruby+me.

The fix
 . is to only set the fpu-in-use-by-this-process flag in the
   exception handler, and then take care of fpu restoring when
   actually returning to userspace

And the patch
 . translates fpu saving and restoring to c in arch_system.c,
   getting rid of a juicy chunk of assembly
 . makes osfxsr_feature private to arch_system.c
 . removes most of the arch dependent code from do_sigsend
2010-06-03 11:32:22 +00:00
Kees van Reeuwijk 36e12d5bd8 Use endpoint_t for the destination of mini_send and _syscall, and the
source of mini_receive.

Also some small cleanup.
2010-06-02 21:51:32 +00:00
Kees van Reeuwijk ed0b81c25c Removed some unused variables and functions. 2010-06-02 19:41:38 +00:00
Tomas Hruby 463be393c2 Gracefull crash if FPU exception in kernel 2010-06-02 13:59:55 +00:00
Tomas Hruby 7bfa47476c Fixed stack trace if panic in stop_context() 2010-06-02 08:53:49 +00:00
Arun Thomas 8579c59b3f Minor makefile changes for GCC 2010-06-01 09:41:31 +00:00
Tomas Hruby 40f440b8cd KCall methods do not depend on m_source and m_type fields
- substituted the use of the m_source message field by
  caller->p_endpoint in kernel calls. It is the same information, just
  passed more intuitively.
  
- the last dependency on m_type field is removed.
  
- do_unused() is substituted by a check for NULL.

- this pretty much removes the depency of kernel calls on the general
  message format. In the future this may be used to pass the kcall
  arguments in a different structure or registers (x86-64, ARM?) The
  kcall number may be passed in a register already.
2010-06-01 08:54:31 +00:00
Tomas Hruby ebbd319ac0 do_safecopy split
- removes dependency of do_safecopy() on the m_type field of the kcall
  messages.

- instead of do_safecopy() figuring out what action is requested, the
  correct safecopy method is called right away.
2010-06-01 08:51:37 +00:00
Arun Thomas 007104d60e GCC build fixes/updates
-Set stack sizes for boot image processes
-Increase RS stack size
-Reduce ramdisk size
-HARDWARE task should use kernel stack
-Minor asm tweaks for leading underscores
2010-05-26 18:45:55 +00:00
Tomas Hruby 24764ff47a Fixed ms-based scheduling for legacy timer 2010-05-26 08:20:29 +00:00
David van Moolenbroek 51ff10d7c0 reset alarm timer on PRIVCTL 2010-05-26 07:10:28 +00:00
Tomas Hruby 451a6890d6 scheduling - time quantum in miliseconds
- Currently the cpu time quantum is timer-ticks based. Thus the
  remaining quantum is decreased only if the processes is interrupted
  by a timer tick. As processes block a lot this typically does not
  happen for normal user processes. Also the quantum depends on the
  frequency of the timer.

- This change makes the quantum miliseconds based. Internally the
  miliseconds are translated into cpu cycles. Everytime userspace
  execution is interrupted by kernel the cycles just consumed by the
  current process are deducted from the remaining quantum.

- It makes the quantum system timer frequency independent.

- The boot processes quantum is loosely derived from the tick-based
  quantas and 60Hz timer and subject to future change

- the 64bit arithmetics is a little ugly, will be changes once we have
  compiler support for 64bit integers (soon)
2010-05-25 08:06:14 +00:00
Kees van Reeuwijk ac14a989b3 Fixed some inconsistent strict typing declarations.
Better strict typing.
2010-05-25 07:23:24 +00:00
Erik van der Kouwe 1f11a57141 Oops, last commit included more than was intended 2010-05-20 08:07:47 +00:00
Erik van der Kouwe 5f15ec05b2 More system processes, this was not enough for the release script to run on some configurations 2010-05-20 08:05:07 +00:00
Arun Thomas b0159ad168 Buildsystem changes for GCC
-Makefile updates
-Update mkdep
-Build fixes/warning cleanups for some programs
-Restore leading underscores on global syms in kernel asm files
-Increase ramdisk size
2010-05-19 13:24:15 +00:00
Ben Gras 6d0e53c2ca use oxpcie only if enabled to avoid baud bottleneck of uart. 2010-05-19 10:18:46 +00:00
Ben Gras 9ba760e603 kernel: oxpcie serial card support.
ask to map in oxpcie i/o memory and support serial i/o for it in the
kernel. set oxpcie=<address> in boot monitor (retrieve address using
pci_debug=1 output). (no sanity checking is done on the address
currently.) disabled by default.

The change also contains some other minor cleanup (a new serial.h to set
register info common to UART and the OXPCIe card, in-kernel memory
mapping a little more structured and env_get() to get sysenv variables
without knowing about the params_buffer).
2010-05-19 10:00:02 +00:00
Tomas Hruby dcc81d73e8 boot image - no need for entry point
- removes the initial_pc from struct boot_image. It is always set
  to 0 and RS uses a.out headers.
2010-05-18 13:51:46 +00:00
Tomas Hruby b09bcf6779 Scheduling server (by Bjorn Swift)
In this second phase, scheduling is moved from PM to its own
scheduler (see r6557 for phase one). In the next phase we hope to a)
include useful information in the "out of quantum" message and b)
create some simple scheduling policy that makes use of that
information.

When the system starts up, PM will iterate over its process table and
ask SCHED to take over scheduling unprivileged processes. This is
done by sending a SCHEDULING_START message to SCHED. This message
includes the processes endpoint, the parent's endpoint and its nice
level. The scheduler adds this process to its schedproc table, issues
a schedctl, and returns its own endpoint to PM - as the endpoint of
the effective scheduler. When a process terminates, a SCHEDULING_STOP
message is sent to the scheduler.

The reason for this effective endpoint is for future compatibility.
Some day, we may have a scheduler that, instead of scheduling the
process itself, forwards the SCHEDULING_START message on to another
scheduler.

PM has information on who schedules whom. As such, scheduling
messages from user-land are sent through PM. An example is when
processes change their priority, using nice(). In that case, a
getsetpriority message is sent to PM, which then sends a
SCHEDULING_SET_NICE to the process's effective scheduler.

When a process is forked through PM, it inherits its parent's
scheduler, but is spawned with an empty quantum. As before, a request
to fork a process flows through VM before returning to PM, which then
wakes up the child process. This flow has been modified slightly so
that PM notifies the scheduler of the new process, before waking up
the child process. If the scheduler fails to take over scheduling,
the child process is torn down and the fork fails with an erroneous
value.

Process priority is entirely decided upon using nice levels. PM
stores a copy of each process's nice level and when a child is
forked, its parent's nice level is sent in the SCHEDULING_START
message. How this level is mapped to a priority queue is up to the
scheduler. It should be noted that the nice level is used to
determine the max_priority and the parent could have been in a lower
priority when it was spawned. To prevent a CPU intensive process from
hawking the CPU by continuously forking children that get scheduled
in the max_priority, the scheduler should determine in which queue
the parent is currently scheduled, and schedule the child in that
same queue.

Other fixes: The USER_Q in kernel/proc.h was incorrectly defined as
NR_SCHED_QUEUES/2. That results in a "off by one" error when
converting priority->nice->priority for nice=0. This also had the
side effect that if someone were to set the MAX_USER_Q to something
else than 0, then USER_Q would be off.
2010-05-18 13:39:04 +00:00