summaryrefslogtreecommitdiffstats
path: root/sys/kern
Commit message (Collapse)AuthorAgeFilesLines
* Add support for specifying a minimal size for vm.kmem_size in the loader viasepotvin2007-04-211-0/+12
| | | | | | | | vm.kmem_size_min. Useful when using ZFS to make sure that vm.kmem size will be at least 256mb (for example) without forcing a particular value via vm.kmem_size. Approved by: njl (mentor) Reviewed by: alc
* Don't reinvent vm_page_grab().pjd2007-04-201-23/+3
| | | | Reviewed by: ups
* Schedule the ithread on the same cpu as the interruptkmacy2007-04-201-2/+1
| | | | | Tested by: kmacy Submitted by: jeffr
* Fix witness(4) warnings about mutex use.jkoshy2007-04-191-0/+10
| | | | | | | | | | | | | | | | | | Group mutexes used in hwpmc(4) into 3 "types" in the sense of witness(4): - leaf spin mutexes---only one of these should be held at a time, so these mutexes are specified as belonging to a single witness type "pmc-leaf". - `struct pmc_owner' descriptors are protected by a spin mutex of witness type "pmc-owner-proc". Since we call wakeup_one() while holding these mutexes, the witness type of these mutexes needs to dominate that of "sleepq chain" mutexes. - logger threads use a sleep mutex, of type "pmc-sleep". Submitted by: wkoszek (earlier patch)
* Fix a bug in sendfile(2) when files larger than page size and nbytes=0.pjd2007-04-191-2/+2
| | | | | | | When nbytes=0, sendfile(2) should use file size. Because of the bug, it was sending half of a file. The bug is that 'off' variable can't be used for size calculation, because it changes inside the loop, so we should use uap->offset instead.
* Bump the interrupt storm detection counter to 1000. My slow fileservernjl2007-04-191-4/+4
| | | | | | | | | | | gets a bogus irq storm detected when periodic daily kicks off at 3 am and disconnects the disk. Change the print logic to print once per second when the storm is occurring instead of only once. Otherwise, it appeared that something else was causing the errors each night at 3 am since the print only occurred the first time. Reviewed by: jhb MFC after: 1 week
* Export vfs_mount_alloc() as it is used in ZFS.pjd2007-04-171-3/+1
|
* - Add a 'show rman <rm>' DDB command to dump the resources in a resourcejhb2007-04-161-0/+50
| | | | | | manager similar to 'devinfo -u'. - Add a 'show allrman' DDB command that effectively does 'show rman' on all resource managers in the system.
* remove now invalid check from m_sanitykmacy2007-04-141-10/+5
| | | | panic on m_sanity check failure with INVARIANTS
* Fix jails and jail-friendly file systems handling:pjd2007-04-133-5/+25
| | | | | | | | - We need to allow for PRIV_VFS_MOUNT_OWNER inside a jail. - Move security checks to vfs_suser() and deny unmounting and updating for jailed root from different jails, etc. OK'ed by: rwatson
* When we are running low on vnodes, there is currently no way to ask otherpjd2007-04-131-0/+1
| | | | | subsystems to release some vnodes. Implement backpressure based on vfs_lowvnodes event (similar to vm_lowmem for memory).
* Remove now-obsolete comment regarding mqueue privileges in jail.rwatson2007-04-111-4/+0
|
* Allow PRIV_NETINET_REUSEPORT in jail.rwatson2007-04-101-1/+3
|
* Do allow POSIX mqueue unlink privilege inside a jail, as we all allrwatson2007-04-101-1/+2
| | | | other POSIX mqueue privileges inside a jail.
* Minor style cleanups (mostly removal of trailing whitespaces).pjd2007-04-101-22/+22
|
* Correct typos.pjd2007-04-101-1/+1
|
* Restore the locking for the sleep/wakeup to avoid waiting an extra 1 secnjl2007-04-091-5/+11
| | | | | if a race was lost. We're still single-threaded at this point, but just be safe for the future.
* Clean up the root mount and mount wait code. No mutexes are needed herenjl2007-04-091-15/+10
| | | | | since a spurious wakeup() is the only possible outcome and this is fine in the BSD programming model.
* Add kern.hostuuid sysctl, which will be used to keep host's UUID.pjd2007-04-091-0/+3
| | | | Reviewed by: mlaier, rink, brooks, rwatson
* Add root_mounted() function that returns true if the root file system ispjd2007-04-081-0/+14
| | | | already mounted.
* prison_free() can be called with a mutex held. This wasn't a problem untilpjd2007-04-081-11/+16
| | | | | | | | | | | I converted allprison_mtx mutex to allprison_lock sx lock. To fix this LOR, move prison removal to prison_complete() entirely. To ensure that noone will reference this prison before it's beeing removed from the list skip prisons with 'pr_ref == 0' in prison_find() and assert that pr_ref has to greater than 0 in prison_hold(). Reported by: kris OK'ed by: rwatson
* Only use prison mutex to protect the fields that need to be protected by it.pjd2007-04-081-2/+2
|
* pr_list is protected by the allprison_lock.pjd2007-04-081-1/+1
|
* Remove XXX comment that changes to file fields should be protected withrwatson2007-04-061-5/+0
| | | | | | | the file lock rather than the filedesc lock: I fixed this in the last revision. Spotted by: kris
* allprison mutex was converted to sx(9) lock.pjd2007-04-051-1/+1
|
* Implement functionality I called 'jail services'.pjd2007-04-051-27/+244
| | | | | | | | | | | | | | | | | | | | | | It may be used for external modules to attach some data to jail's in-kernel structure. - Change allprison_mtx mutex to allprison_sx sx(9) lock. We will need to call external functions while holding this lock, which may want to allocate memory. Make use of the fact that this is shared-exclusive lock and use shared version when possible. - Implement the following functions: prison_service_register() - registers a service that wants to be noticed when a jail is created and destroyed prison_service_deregister() - deregisters service prison_service_data_add() - adds service-specific data to the jail structure prison_service_data_get() - takes service-specific data from the jail structure prison_service_data_del() - removes service-specific data from the jail structure Reviewed by: rwatson
* Make prison_find() globally accessible.pjd2007-04-051-2/+1
|
* Implement SEEK_DATA and SEEK_HOLE extensions to lseek(2) as found inpjd2007-04-051-0/+7
| | | | | | OpenSolaris. For more information please refer to: http://blogs.sun.com/bonwick/entry/seek_hole_and_seek_data
* Add security.jail.mount_allowed sysctl, which allows to mount andpjd2007-04-052-0/+24
| | | | | | | | | | | | | | | | | | unmount jail-friendly file systems from within a jail. Precisely it grants PRIV_VFS_MOUNT, PRIV_VFS_UNMOUNT and PRIV_VFS_MOUNT_NONUSER privileges for a jailed super-user. It is turned off by default. A jail-friendly file system is a file system which driver registers itself with VFCF_JAIL flag via VFS_SET(9) API. The lsvfs(1) command can be used to see which file systems are jail-friendly ones. There currently no jail-friendly file systems, ZFS will be the first one. In the future we may consider marking file systems like nullfs as jail-friendly. Reviewed by: rwatson
* Fix mb_ctor_clust and mb_dtor_clust to reference the appropriate zone,kmacy2007-04-041-29/+37
| | | | | | | simplify setting refcnt Reviewed by: andre, rwatson, and glebius MFC after: 3 days
* Replace custom file descriptor array sleep lock constructed using a mutexrwatson2007-04-0412-257/+264
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and flags with an sxlock. This leads to a significant and measurable performance improvement as a result of access to shared locking for frequent lookup operations, reduced general overhead, and reduced overhead in the event of contention. All of these are imported for threaded applications where simultaneous access to a shared file descriptor array occurs frequently. Kris has reported 2x-4x transaction rate improvements on 8-core MySQL benchmarks; smaller improvements can be expected for many workloads as a result of reduced overhead. - Generally eliminate the distinction between "fast" and regular acquisisition of the filedesc lock; the plan is that they will now all be fast. Change all locking instances to either shared or exclusive locks. - Correct a bug (pointed out by kib) in fdfree() where previously msleep() was called without the mutex held; sx_sleep() is now always called with the sxlock held exclusively. - Universally hold the struct file lock over changes to struct file, rather than the filedesc lock or no lock. Always update the f_ops field last. A further memory barrier is required here in the future (discussed with jhb). - Improve locking and reference management in linux_at(), which fails to properly acquire vnode references before using vnode pointers. Annotate improper use of vn_fullpath(), which will be replaced at a future date. In fcntl(), we conservatively acquire an exclusive lock, even though in some cases a shared lock may be sufficient, which should be revisited. The dropping of the filedesc lock in fdgrowtable() is no longer required as the sxlock can be held over the sleep operation; we should consider removing that (pointed out by attilio). Tested by: kris Discussed with: jhb, kris, attilio, jeff
* fix typokmacy2007-04-041-1/+1
|
* style fixes and make sure that the lock is treated as released in the ↵kmacy2007-04-041-4/+5
| | | | | | sharers == 0 case not that this is somewhat racy because a new sharer can come in while we're updating stats
* Fixes to sx for newsx - fix recursed case and move out of inlinekmacy2007-04-031-8/+31
| | | | Submitted by: Attilio Rao <attilio@freebsd.org>
* move lock_profile calls out of the macros and into kern_mutex.ckmacy2007-04-031-9/+17
| | | | add check for mtx_recurse == 0 when releasing sleep lock
* skip call to _lock_profile_obtain_lock_success entirely if acquisition time ↵kmacy2007-04-031-14/+11
| | | | | | is non-zero (i.e. recursing or adding sharers)
* Add root_mount_wait() function which can be used to wait until the rootpjd2007-04-031-10/+58
| | | | | file system is mounted. This is useful for kernel modules loaded from /boot/loader.conf, that have to access file system.
* Fix a fd leak in socketpair():jhb2007-04-021-2/+7
| | | | | | - Close the new file objects created during socketpair() if the copyout of the new file descriptors fails. - Add a test to the socketpair regression test for this edge case.
* Don't go to a whole lot of extra work to handle the race where the newjhb2007-04-021-25/+2
| | | | | | file descriptor is closed out from under us in kern_open(). This race is already handled and the file will be closed when kern_open() does an fdrop just before returning.
* ng_node and ng_worklist locks both migrated from being spinning locks towkoszek2007-04-011-2/+6
| | | | | | | adaptive mutexes. Let witness(4) calm down and bring proper types of those locks to the lock order database. Glanced at by: rwatson
* I think the code I'm removing here is completely bogus.pjd2007-04-011-3/+0
| | | | | | | | | | | | | | | | | | | vfs_flags field is used for VFCF_* flags which are given at file system driver creation time (via VFS_SET(9)) macro. What this code did was bascially this: If file system registers itself with VFCF_UNICODE flag (stores file names as Unicode), it will gain MNT_SOFTDEP flag (UFS soft-updates). If file system registers itself with VFCF_LOOPBACK flag (aliases some other mounted FS), it will gain MNT_SUIDDIR flag (special handling of SUID on dirs). The latter will be quite dangerous, but those flags are reset later in vfs_domount(). MFC after: 1 month
* Now that the vdropl() function is public, assert that the vnode interlockpjd2007-04-011-0/+1
| | | | is held.
* Make vdropl() public; zfs needs it. There is also plenty of existingdes2007-03-311-2/+1
| | | | | | | | | | | | | | | | | file system code (mostly *_reclaim()) which look like this: VOP_LOCK(vp); /* examine vp */ VOP_UNLOCK(vp); vdrop(vp); This can now be rewritten to: VOP_LOCK(vp); /* examine vp */ vdropl(vp); /* will unlock vp */ MFC after: 1 week
* Optimize sx locks to use simple atomic operations for the common cases ofjhb2007-03-311-230/+682
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | obtaining and releasing shared and exclusive locks. The algorithms for manipulating the lock cookie are very similar to that rwlocks. This patch also adds support for exclusive locks using the same algorithm as mutexes. A new sx_init_flags() function has been added so that optional flags can be specified to alter a given locks behavior. The flags include SX_DUPOK, SX_NOWITNESS, SX_NOPROFILE, and SX_QUITE which are all identical in nature to the similar flags for mutexes. Adaptive spinning on select locks may be enabled by enabling the ADAPTIVE_SX kernel option. Only locks initialized with the SX_ADAPTIVESPIN flag via sx_init_flags() will adaptively spin. The common cases for sx_slock(), sx_sunlock(), sx_xlock(), and sx_xunlock() are now performed inline in non-debug kernels. As a result, <sys/sx.h> now requires <sys/lock.h> to be included prior to <sys/sx.h>. The new kernel option SX_NOINLINE can be used to disable the aforementioned inlining in non-debug kernels. The size of struct sx has changed, so the kernel ABI is probably greatly disturbed. MFC after: 1 month Submitted by: attilio Tested by: kris, pjd
* Make vfs_mount_destroy() and vfs_freeopts() non-static, I'd like to use them.pjd2007-03-311-3/+2
|
* Rather than ignoring any error return from getnewvnode() in nameiinit(),rwatson2007-03-311-1/+5
| | | | | | | | explicitly test and panic. This should not ever happen, but if it does, this is a preferred failure mode to a NULL pointer dereference in kernel. Coverity CID: 1716 Found with: Coverity Prevent(tm)
* - Drop memory barriers in rw_try_upgrade(). We don't need an 'acq' memoryjhb2007-03-301-4/+4
| | | | | barrier here as the earlier rw_rlock() already contained one. - Comment fix.
* - Use lock_init/lock_destroy() to setup the lock_object inside of lockmgr.jhb2007-03-301-7/+11
| | | | | | | We can now use LOCK_CLASS() as a stronger check in lockmgr_chain() as a result. This required putting back lk_flags as lockmgr's use of flags conflicted with other flags in lo_flags otherwise. - Tweak 'show lock' output for lockmgr to match sx, rw, and mtx.
* vm_map_delete should be used only internally, by the VM subsystem. Replacewkoszek2007-03-291-6/+2
| | | | | | | | it with vm_map_remove, which not only embeds additional check, but also takes care of locking. Reviewed by: alc Approved by: alc, cognet (mentor)
* Align 'struct thread' on 16 byte boundaries so that the lower 4 bits arejhb2007-03-272-2/+2
| | | | | | | | | | always 0. Previously we aligned threads on a minimum of 8-byte boundaries. Note: This changes the uma zone to no longer cache align threads. We really want the uma zone to do align threads to MAX(16, cache line size) but there currently isn't a good way to express that to uma. Submitted by: attilio
OpenPOWER on IntegriCloud