summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* - Keep seperate statistics and run queues for different scheduling classes.jeff2003-04-031-48/+134
| | | | | | | | - Treat each class specially in kseq_{choose,add,rem}. Let the rest of the code be less aware of scheduling classes. - Skip the interactivity calculation for non TIMESHARE ksegrps. - Move slice and runq selection into kseq_add(). Uninline it now that it's big.
* Commit a partial lazy thread switch mechanism for i386. it isn't as lazypeter2003-04-026-4/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | as it could be and can do with some more cleanup. Currently its under options LAZY_SWITCH. What this does is avoid %cr3 reloads for short context switches that do not involve another user process. ie: we can take an interrupt, switch to a kthread and return to the user without explicitly flushing the tlb. However, this isn't as exciting as it could be, the interrupt overhead is still high and too much blocks on Giant still. There are some debug sysctls, for stats and for an on/off switch. The main problem with doing this has been "what if the process that you're running on exits while we're borrowing its address space?" - in this case we use an IPI to give it a kick when we're about to reclaim the pmap. Its not compiled in unless you add the LAZY_SWITCH option. I want to fix a few more things and get some more feedback before turning it on by default. This is NOT a replacement for Bosko's lazy interrupt stuff. This was more meant for the kthread case, while his was for interrupts. Mine helps a little for interrupts, but his helps a lot more. The stats are enabled with options SWTCH_OPTIM_STATS - this has been a pseudo-option for years, I just added a bunch of stuff to it. One non-trivial change was to select a new thread before calling cpu_switch() in the first place. This allows us to catch the silly case of doing a cpu_switch() to the current process. This happens uncomfortably often. This simplifies a bit of the asm code in cpu_switch (no longer have to call choosethread() in the middle). This has been implemented on i386 and (thanks to jake) sparc64. The others will come soon. This is actually seperate to the lazy switch stuff. Glanced at by: jake, jhb
* Lock the process before sending it a SIGIO. Not doing so is a panic(2)jhb2003-04-021-2/+7
| | | | implementation with INVARIANTS.
* Need to hold the same SMP lock for (knote) list traversal as forhsu2003-04-021-1/+1
| | | | | list manipulation. This lock also protects read-modify-write operations on the pipe_state field.
* - Make the interactivity calculator decay faster.jeff2003-04-021-2/+2
| | | | - Make the pcpu estimator update faster.
* - I meant divide by two and not shift by two in SCHED_PRI_NHALF.jeff2003-04-021-1/+1
|
* - Make casuptr return the old value of the location we're trying to update,jake2003-04-021-10/+13
| | | | | | and change the umtx code to expect this. Reviewed by: jeff
* - Add in support for KSEs with 0 slice values on the run queue. If we tryjeff2003-04-021-34/+90
| | | | | | | | | | | | | | | | 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.
* - Fix UC_COPY_SIZE. Adding up the size of structure fields doesn't takejake2003-04-011-4/+3
| | | | | | alignment into account. - Return EJUSTRETURN from set_context on success to avoid clobbering the first 2 out registers with td_retval on sparc64.
* #include <geom/geom_disk.h>phk2003-04-011-0/+1
|
* Introduce bioq_flush() function.phk2003-04-011-0/+15
|
* - p will be unused in cursig() if INVARIANTS is not defined. Access itjeff2003-04-011-3/+1
| | | | | | through td->td_proc to avoid the unused variable. Spotted by: Maxim Konovalov <maxim@macomnet.ru>
* - Regen.jeff2003-04-012-6/+6
|
* - thr_exit() should no longer be called with Giant held.jeff2003-04-011-2/+0
|
* - Mark the various thr syscalls as MP safe. Previously there was a bug ifjeff2003-04-011-4/+4
| | | | this was not done since thr_exit() unwinds giant.
* - Borrow the KSE single threading code for exec and exit. We use the checkjeff2003-04-016-10/+25
| | | | | | | | if (p->p_numthreads > 1) and not a flag because action is only necessary if there are other threads. The rest of the system has no need to identify thr threaded processes. - In kern_thread.c use thr_exit1() instead of thread_exit() if P_THREADED is not set.
* - Regen for umtx.jeff2003-04-012-2/+6
|
* - Include umtx.h in files generated by makesyscalls.shjeff2003-04-012-0/+3
| | | | - Add system calls for umtx.
* - Add an api for doing smp safe locks in userland.jeff2003-04-011-0/+303
| | | | | | | | | | | | - umtx_lock() is defined as an inline in umtx.h. It tries to do an uncontested acquire of a lock which falls back to the _umtx_lock() system-call if that fails. - umtx_unlock() is also an inline which falls back to _umtx_unlock() if the uncontested unlock fails. - Locks are keyed off of the thr_id_t of the currently running thread which is currently just the pointer to the 'struct thread' in kernel. - _umtx_lock() uses the proc pointer to synchronize access to blocked thread queues which are stored in the first blocked thread.
* - We now have to include umtx.h and ucontext.h in the system call relatedjeff2003-04-011-0/+2
| | | | headers.
* - Regen for thr related system calls.jeff2003-04-012-2/+10
|
* - Add the four thr related system calls.jeff2003-04-011-0/+4
|
* - Add two files to support the thr threading interface.jeff2003-04-011-0/+259
| | | | | | - sys/thr.h contains the user space visible api that is intended only for use in threading library packages. - kern/kern_thr.c contains thr system calls and other thr specific code.
* - Regen for the sig*wait* system calls.jeff2003-03-312-6/+8
|
* - Define sigwait, sigtimedwait, and sigwaitinfo in terms ofjeff2003-03-312-3/+178
| | | | | | kern_sigtimedwait() which is capable of supporting all of their semantics. - These should be POSIX compliant but more careful review is needed before we announce this.
* - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread withjeff2003-03-3110-146/+269
| | | | | | | a follow on commit to kern_sig.c - signotify() now operates on a thread since unmasked pending signals are stored in the thread. - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.
* Do NOT return from an non-interruptable cv_wait, falselyjulian2003-03-311-2/+0
| | | | claiming to have timed out. I don't know what I was thinking..
* - Mark signals which may be delivered to any thread in the process withjeff2003-03-311-31/+32
| | | | | SA_PROC. Signals without this flag should be directed to a particular thread if this is possible.
* - Change trapsignal() to accept a thread and not a proc.jeff2003-03-312-7/+7
| | | | | | | - Change all consumers to pass in a thread. Right now this does not cause any functional changes but it will be important later when signals can be delivered to specific threads.
* Recent changes to uipc_cow.c have eliminated the need for some sf_buf-alc2003-03-311-3/+3
| | | | | related variables to be global. Make them either local to sf_buf_init() or static.
* retire the "busy" field in bioqueues, it's served it's purpose.phk2003-03-301-8/+0
|
* Preparation commit before I start on the bioqueue lockdown:phk2003-03-302-25/+43
| | | | | Collect all the bits of bioqueue handing in subr_disk.c, vfs_bio.c is big enough as it is and disksort already lives in subr_disk.c.
* - We are not guaranteed that read ahead blocks are not in memory already.jeff2003-03-301-1/+9
| | | | | Check for B_DELWRI as well as B_CACHED before issuing io on a buffer. This is especially important since we are changing the b_iocmd.
* Pass the vm_page's address to sf_buf_alloc(); map the vm_page as partalc2003-03-292-12/+7
| | | | | | | | | | of sf_buf_alloc() instead of expecting sf_buf_alloc()'s caller to map it. The ultimate reason for this change is to enable two optimizations: (1) that there never be more than one sf_buf mapping a vm_page at a time and (2) 64-bit architectures can transparently use their 1-1 virtual to physical mapping (e.g., "K0SEG") avoiding the overhead of pmap_qenter() and pmap_qremove().
* Add the m_defrag routine, as discussed on committers@. Thissilby2003-03-291-0/+83
| | | | | | | incarnation should address the concerns of all in the discussion, and keeps statistics which show how much it is used. MFC after: 2 weeks
* Check for the PS_NEEDSIGCHK flag in the right flags field.jhb2003-03-282-2/+2
|
* Allow m_dup_pkthdr to accept mbufs with attached clusters assilby2003-03-281-3/+3
| | | | | | targets. Submitted by: bmilekic
* Add a checksum to the kernel message buffer, and update it everyiedowse2003-03-281-4/+24
| | | | | | | | | | | | time a character is written. Use this at boot time to reject the existing buffer contents if they are corrupt. This fixes a problem seen on some hardware (especially laptops) where the message buffer gets partially corrupted during a short power cycle or reset, but the msgbuf structure is left intact so it gets reused, resulting in random junk and control characters appearing in dmesg and /var/log/messages. PR: kern/28497
* Add support for reading directly from file to userland buffer when thetegge2003-03-261-0/+12
| | | | | O_DIRECT descriptor status flag is set and both offset and length is a multiple of the physical media sector size.
* Adjust the number of vnodes scanned by vlrureclaim() according to thetegge2003-03-262-8/+14
| | | | size of the vnode list.
* Permit debug.malloc.failure_rate to be specified using a tunable sorwatson2003-03-261-0/+1
| | | | | | | that the feature can be enabled during the boot process. Note the continued limitation that FreeBSD fails so rapidly with this setting enabled that it's hard to narrow down particular failures for correction; we really need per-malloc type failure rates.
* Add a new kernel option, MALLOC_MAKE_FAILURES, which compilesrwatson2003-03-261-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | in a debugging feature causing M_NOWAIT allocations to fail at a specified rate. This can be useful for detecting poor handling of M_NOWAIT: the most frequent problems I've bumped into are unconditional deference of the pointer even though it's NULL, and hangs as a result of a lost event where memory for the event couldn't be allocated. Two sysctls are added: debug.malloc.failure_rate How often to generate a failure: if set to 0 (default), this feature is disabled. Otherwise, the frequency of failures -- I've been using 10 (one in ten mallocs fails), but other popular settings might be much lower or much higher. debug.malloc.failure_count Number of times a coerced malloc failure has occurred as a result of this feature. Useful for tracking what might have happened and whether failures are being generated. Useful possible additions: tying failure rate to malloc type, printfs indicating the thread that experienced the coerced failure. Reviewed by: jeffr, jhb
* fp->f_offset doesn't need any protection when it isn't accessed.tegge2003-03-261-2/+4
|
* Modify the mac_init_ipq() MAC Framework entry point to accept anrwatson2003-03-261-4/+12
| | | | | | | | | | | | | additional flags argument to indicate blocking disposition, and pass in M_NOWAIT from the IP reassembly code to indicate that blocking is not OK when labeling a new IP fragment reassembly queue. This should eliminate some of the WITNESS warnings that have started popping up since fine-grained IP stack locking started going in; if memory allocation fails, the creation of the fragment queue will be aborted. Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* Remove extraneous check. We are not going to return from copyin/out onjhb2003-03-251-2/+0
| | | | the stack of a thread A but actually be thread B instead of thread A.
* Give print_child a default method.mdodd2003-03-251-1/+1
|
* - Add vm_paddr_t, a physical address type. This is required for systemsjake2003-03-256-6/+7
| | | | | | | | | | | | | | | where physical addresses larger than virtual addresses, such as i386s with PAE. - Use this to represent physical addresses in the MI vm system and in the i386 pmap code. This also changes the paddr parameter to d_mmap_t. - Fix printf formats to handle physical addresses >4G in the i386 memory detection code, and due to kvtop returning vm_paddr_t instead of u_long. Note that this is a name change only; vm_paddr_t is still the same as vm_offset_t on all currently supported platforms. Sponsored by: DARPA, Network Associates Laboratories Discussed with: re, phk (cdevsw change)
* Replace the at_fork, at_exec, and at_exit functions with the slightly morejhb2003-03-246-226/+37
| | | | | | | | | flexible process_fork, process_exec, and process_exit eventhandlers. This reduces code duplication and also means that I don't have to go duplicate the eventhandler locking three more times for each of at_fork, at_exec, and at_exit. Reviewed by: phk, jake, almost complete silence on arch@
* - Remove witness_dead and just use witness_watch instead. If witness_watchjhb2003-03-241-21/+51
| | | | | | | | | | is set to 0, it now has the same affect as setting witness_dead used to have. - Added a sysctl handler that allows root to change witness_watch from a non-zero value to zero to disable witness at runtime. Note that you can't turn witness back on once it is off. You can only turn it off as a one-way switch. - Added a comment describing the possible values of witness_watch.
* Remove a trailing semicolon in SCHED_QUANTUM definition.mux2003-03-241-1/+1
| | | | | | Luckily this didn't cause any bugs. Spotted by: Samy Al Bahra <samy@kerneled.com>
OpenPOWER on IntegriCloud