aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Remove a potential deadlock on i386 SMP by changing the lazypmap ipi andJohn Baldwin2004-08-041-1/+0
| | | | | | | | | | | spin-wait code to use the same spin mutex (smp_tlb_mtx) as the TLB ipi and spin-wait code snippets so that you can't get into the situation of one CPU doing a TLB shootdown to another CPU that is doing a lazy pmap shootdown each of which are waiting on each other. With this change, only one of the CPUs would do an IPI and spin-wait at a time. Notes: svn path=/head/; revision=133139
* Workaround a possible deadlock on SMP due to a spin lock LOR by disablingJohn Baldwin2004-08-041-0/+6
| | | | | | | | | | | the immediate awakening of proc0 (scheduler kproc, controls swapping processes in and out). The scheduler process periodically awakens already, so this will not result in processes not being swapped in, there will just be more latency in between a thread being made runnable and the scheduler waking up to swap the affected process back in. Notes: svn path=/head/; revision=133138
* Cache the value of curthread in the _get_sleep_lock() and _get_spin_lock()John Baldwin2004-08-041-4/+5
| | | | | | | | | | | | macros and pass the value to the associated _mtx_*() functions to avoid more curthread dereferences in the function implementations. This provided a very modest perf improvement in some benchmarks. Suggested by: rwatson Tested by: scottl Notes: svn path=/head/; revision=133137
* Assert Giant in namei(). Bugs have been reported in which, followingRobert Watson2004-08-041-0/+2
| | | | | | | | | | a sleep() call waking up in namei(), a later assertion triggers that Giant is not held. By asserting Giant at the start of namei(), we can know that if that assertion triggers, Giant is lost during the call to namei(), and not before. Notes: svn path=/head/; revision=133131
* Assert Giant in the following file descriptor-related functions:Robert Watson2004-08-041-0/+10
| | | | | | | | | | | | | Function Reason -------- ------ fdfree() VFS setugidsafety() KQueue fdcheckstd() VFS _fgetvp() VFS fgetsock() Conditional assertion based on debug.mpsafenet Notes: svn path=/head/; revision=133130
* Remove spl's from kern_resource.c.Robert Watson2004-08-041-4/+0
| | | | Notes: svn path=/head/; revision=133126
* Instead of calling ia32_pause() conditionally on __i386__ or __amd64__Maxime Henrion2004-08-031-15/+5
| | | | | | | | | | | | being defined, define and use a new MD macro, cpu_spinwait(). It only expands to something on i386 and amd64, so the compiled code should be identical. Name of the macro found by: jhb Reviewed by: jhb Notes: svn path=/head/; revision=133084
* Don't skip permission checks when sending signals to zombie processes.Pawel Jakub Dawidek2004-08-031-13/+7
| | | | | | | | Pointed out by: bde Reviewed by: rwatson Notes: svn path=/head/; revision=133078
* Standardize pipe locking, ensuring that everything is locked viaMike Silbersack2004-08-031-152/+115
| | | | | | | | | | | | pipelock(), not via a mixture of mutexes and pipelock(). Additionally, add a few KASSERTS, and change some statements that should have been KASSERTS into KASSERTS. As a result of these cleanups, some segments of code have become significantly shorter and/or easier to read. Notes: svn path=/head/; revision=133049
* s/TMDF_DONOTRUNUSER/TMDF_SUSPEND/gDavid Xu2004-08-031-2/+2
| | | | | | | Dicussed with: deischen Notes: svn path=/head/; revision=133047
* Repeat after me:Julian Elischer2004-08-031-0/+1
| | | | | | | "Do not apply your tested patches to your commit tree by hand" Notes: svn path=/head/; revision=133045
* Remove an argument that is never used.Julian Elischer2004-08-021-7/+6
| | | | Notes: svn path=/head/; revision=133043
* Put a cap on the auto-tuning of kern.maxvnodes.David E. O'Brien2004-08-021-0/+8
| | | | | | | Cap value chosen by: scottl Notes: svn path=/head/; revision=133038
* Add what appears to be a missing '*/' at the end of a comment.Robert Watson2004-08-021-0/+1
| | | | Notes: svn path=/head/; revision=132990
* * Add a "how" argument to uma_zone constructors and initialization functionsBrian Feldman2004-08-024-55/+60
| | | | | | | | | | | | | | | | | | | | so that they know whether the allocation is supposed to be able to sleep or not. * Allow uma_zone constructors and initialation functions to return either success or error. Almost all of the ones in the tree currently return success unconditionally, but mbuf is a notable exception: the packet zone constructor wants to be able to fail if it cannot suballocate an mbuf cluster, and the mbuf allocators want to be able to fail in general in a MAC kernel if the MAC mbuf initializer fails. This fixes the panics people are seeing when they run out of memory for mbuf clusters. * Allow debug.nosleepwithlocks on WITNESS to be disabled, without changing the default. Both bmilekic and jeff have reviewed the changes made to make failable zone allocations work. Notes: svn path=/head/; revision=132987
* Comment kse_create() and make a few minor code cleanupsJulian Elischer2004-08-011-47/+121
| | | | | | | Reviewed by: davidxu Notes: svn path=/head/; revision=132985
* Put a version element in the VFS filesystem configuration structurePoul-Henning Kamp2004-07-302-54/+60
| | | | | | | | | | | | | | | | | | | | | and refuse initializing filesystems with a wrong version. This will aid maintenance activites on the 5-stable branch. s/vfs_mount/vfs_omount/ s/vfs_nmount/vfs_mount/ Name our filesystems mount function consistently. Eliminate the namiedata argument to both vfs_mount and vfs_omount. It was originally there to save stack space. A few places abused it to get hold of some credentials to pass around. Effectively it is unused. Reorganize the root filesystem selection code. Notes: svn path=/head/; revision=132902
* Giant is no longer required by vm_waitproc() and vmspace_exitfree().Alan Cox2004-07-301-2/+0
| | | | | | | Eliminate it acquisition and release around vm_waitproc() in kern_wait(). Notes: svn path=/head/; revision=132898
* Minor message cleanup.Nate Lawson2004-07-302-6/+4
| | | | Notes: svn path=/head/; revision=132866
* Syscall kill(2) called for a zombie process should return 0.Pawel Jakub Dawidek2004-07-291-1/+10
| | | | | | | Obtained from: Darwin Notes: svn path=/head/; revision=132856
* Fill some informations about zombie processes as well.Pawel Jakub Dawidek2004-07-291-7/+6
| | | | | | | | | | Before this change every zombie process were reported as an owner of PID 0 in ps(1) output. Reviewed by: julian Notes: svn path=/head/; revision=132855
* Remove global variable rootdevs and rootvp, they are unused as such.Poul-Henning Kamp2004-07-281-1/+0
| | | | | | | | | | | Add local rootvp variables as needed. Remove checks for miniroot's in the swappartition. We never did that and most of the filesystems could never be used for that, but it had still been copy&pasted all over the place. Notes: svn path=/head/; revision=132805
* Avoid casts as lvalues.Alexander Kabaev2004-07-283-7/+6
| | | | Notes: svn path=/head/; revision=132776
* Use P_SINGLE_EXIT to check single-threading case, P_WEXIT is not for thatDavid Xu2004-07-281-1/+1
| | | | | | | purpose. Notes: svn path=/head/; revision=132773
* Convert the vfsconf list to a TAILQ.Poul-Henning Kamp2004-07-273-129/+102
| | | | | | | | | | | Introduce vfs_byname() function to find things on it. Staticize vfs_nmount() function under the name vfs_donmount(). Various cleanups. Notes: svn path=/head/; revision=132710
* Pass a thread argument into cpu_critical_{enter,exit}() rather thanRobert Watson2004-07-271-2/+2
| | | | | | | | | | | | dereference curthread. It is called only from critical_{enter,exit}(), which already dereferences curthread. This doesn't seem to affect SMP performance in my benchmarks, but improves MySQL transaction throughput by about 1% on UP on my Xeon. Head nodding: jhb, bmilekic Notes: svn path=/head/; revision=132700
* Add "options ADAPTIVE_GIANT" which causes Giant to also be treated inRobert Watson2004-07-271-0/+4
| | | | | | | | | | | | | an adaptive fashion when adaptive mutexes are enabled. The theory behind non-adaptive Giant is that Giant will be held for long periods of time, and therefore spinning waiting on it is wasteful. However, in MySQL benchmarks which are relatively Giant-free, running Giant adaptive makes an observable difference on SMP (5% transaction rate improvement). As such, make adaptive behavior on Giant an option so it can be more widely benchmarked. Notes: svn path=/head/; revision=132698
* - Use atomic ops for updating the vmspace's refcnt and exitingcnt.Alan Cox2004-07-274-17/+17
| | | | | | | | | | | - Push down Giant into shmexit(). (Giant is acquired only if the vmspace contains shm segments.) - Eliminate the acquisition of Giant from proc_rwmem(). - Reduce the scope of Giant in exit1(), uncovering the destruction of the address space. Notes: svn path=/head/; revision=132684
* Move the schedlock owner state update following the contextBosko Milekic2004-07-271-12/+14
| | | | | | | | | | | | switch in fork_exit() to before anything else is done (but keep schedlock for the deadthread check). This means one less nasty bug if ever in the future whatever might have been called before the update played with schedlock or critical sections. Discussed with: tjr Notes: svn path=/head/; revision=132682
* In revision 1.228, I accidentally broke the "total number of processes inColin Percival2004-07-261-1/+2
| | | | | | | | | | | | | | | the system" resource limit code: When checking if the caller has superuser privileges, we should be checking the *real* user, not the *effective* user. (In general, resource limiting is done based on the real user, in order to avoid resource-exhaustion-by-setuid-program attacks.) Now that a SUSER_RUID flag to suser_cred exists, use it here to return this code to its correct behaviour. Pointed out by: rwatson Notes: svn path=/head/; revision=132655
* Rename suser_cred()'s PRISON_ROOT flag to SUSER_ALLOWJAIL. This isColin Percival2004-07-2612-60/+60
| | | | | | | | | | | | | | somewhat clearer, but more importantly allows for a consistent naming scheme for suser_cred flags. The old name is still defined, but will be removed in a few days (unless I hear any complaints...) Discussed with: rwatson, scottl Requested by: jhb Notes: svn path=/head/; revision=132653
* Revert modification of subr_turnstile.c accidentally included in theRobert Watson2004-07-251-1/+0
| | | | | | | | last commit; this assertion was provided by jhb for local debugging and not intended for broader consumption. Notes: svn path=/head/; revision=132646
* In uipc_connect(), assert that the passed thread is curthread, and passRobert Watson2004-07-252-1/+4
| | | | | | | td into unp_connect() instead of reading curthread. Notes: svn path=/head/; revision=132645
* Do some initial locking on accept filter registration and attach. WhileRobert Watson2004-07-251-29/+76
| | | | | | | | | here, close some races that existed in the pre-locking world during low memory conditions. This locking isn't perfect, but it's closer than before. Notes: svn path=/head/; revision=132644
* Eliminate unused second argument to reassignbuf() and simplify itPoul-Henning Kamp2004-07-253-34/+15
| | | | | | | accordingly. Notes: svn path=/head/; revision=132640
* Add netatalk mutexes to hard-coded WITNESS lock order.Robert Watson2004-07-251-0/+6
| | | | Notes: svn path=/head/; revision=132639
* Expand the generic, but bogusly formed, copyright notice to includeWarner Losh2004-07-251-1/+21
| | | | | | | | | | | | | | the license from /usr/src/COPYRIGHT. Since cvs annotate shows that this was written by jasone, julian, jhb, peter, bmilekic and obrien. cvs log shows that many others may have contributed to this file. As such, go ahead and use the author of 'FreeBSD Project' for this file. If this is a problem, please notify me. # this eliminates the last file in the kernel with an indirect reference # to /usr/src/COPYRIGHT in the kernel. A few more in userland remain. Notes: svn path=/head/; revision=132637
* Neuter this warning for now, I think I know the remaining issues.Poul-Henning Kamp2004-07-251-1/+2
| | | | Notes: svn path=/head/; revision=132628
* White space fix..Julian Elischer2004-07-241-3/+3
| | | | | | | diff reduction for upcoming commit. Notes: svn path=/head/; revision=132592
* Clean up whitespace, increase consistency and correctness.Scott Long2004-07-232-13/+9
| | | | | | | Submitted by: bde Notes: svn path=/head/; revision=132589
* Don't include a "\n" in KTR output, it confuses automatic parsing.Robert Watson2004-07-231-1/+1
| | | | Notes: svn path=/head/; revision=132587
* Remove the previous hack since it doesn't make a difference and is gettingScott Long2004-07-231-2/+0
| | | | | | | in the way of debugging. Notes: svn path=/head/; revision=132586
* Use kmem_alloc_nofault() rather than kmem_alloc_pageable() for allocatingAlan Cox2004-07-231-1/+1
| | | | | | | | KVA for explicitly managed mappings, i.e., mappings created with pmap_qenter(). Notes: svn path=/head/; revision=132585
* Export KTR_COMPILE as a sysctl so you can easily check from user spaceRobert Watson2004-07-231-0/+3
| | | | | | | what event mask has been compiled into the kernel. Notes: svn path=/head/; revision=132583
* Don't perform pipe endpoint locking during pipe_create(), as the pipeRobert Watson2004-07-231-11/+20
| | | | | | | | | | | | | can't yet be referenced by other threads. In microbenchmarks, this appears to reduce the cost of pipe();close();close() on UP by 10%, and SMP by 7%. The vast majority of the cost of allocating a pipe remains VM magic. Suggested by: silby Notes: svn path=/head/; revision=132579
* In setpgid(), since td is passed in as a system call argument, use itRobert Watson2004-07-231-1/+1
| | | | | | | in preference to curthread, which costs slightly more. Notes: svn path=/head/; revision=132568
* Push Giant acquisition down into fo_stat() from most callers. AcquireRobert Watson2004-07-224-7/+8
| | | | | | | | | | | | | | Giant conditional on debug.mpsafenet in the socket soo_stat() routine, unconditionally in vn_statfile() for VFS, and otherwise don't acquire Giant. Accept an unlocked read in kqueue_stat(), and cryptof_stat() is a no-op. Don't acquire Giant in fstat() system call. Note: in fdescfs, fo_stat() is called while holding Giant due to the VFS stack sitting on top, and therefore there will still be Giant recursion in this case. Notes: svn path=/head/; revision=132554
* Push acquisition of Giant from fdrop_closed() into fo_close() so thatRobert Watson2004-07-224-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | individual file object implementations can optionally acquire Giant if they require it: - soo_close(): depends on debug.mpsafenet - pipe_close(): Giant not acquired - kqueue_close(): Giant required - vn_close(): Giant required - cryptof_close(): Giant required (conservative) Notes: Giant is still acquired in close() even when closing MPSAFE objects due to kqueue requiring Giant in the calling closef() code. Microbenchmarks indicate that this removal of Giant cuts 3%-3% off of pipe create/destroy pairs from user space with SMP compiled into the kernel. The cryptodev and opencrypto code appears MPSAFE, but I'm unable to test it extensively and so have left Giant over fo_close(). It can probably be removed given some testing and review. Notes: svn path=/head/; revision=132549
* suser() accepts a thread argument; as suser() dereferences td_ucred, aRobert Watson2004-07-221-0/+12
| | | | | | | | | | | | thread-local pointer, in practice that thread needs to be curthread. If we're running with INVARIANTS, generate a warning if not. If we have KDB compiled in, generate a stack trace. This doesn't fire at all in my local test environment, but could be irritating if it fires frequently for someone, so there will be motivation to fix things quickly when it does. Notes: svn path=/head/; revision=132548
* Disable the PREEMPTION-enabled code in critical_exit() that encouragesScott Long2004-07-221-0/+2
| | | | | | | | switching to a different thread. This is just a hack to try to improve stability some more, but likely points closer to the real culprit. Notes: svn path=/head/; revision=132543