summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_unix.c
Commit message (Collapse)AuthorAgeFilesLines
* - Improve readability of sys_obreak().zont2013-01-111-22/+21
| | | | | | | Suggested by: alc Reviewed by: alc Approved by: kib (mentor) MFC after: 1 week
* - Reduce kernel size by removing unnecessary pointer indirections.zont2013-01-101-5/+4
| | | | | | | | | GENERIC kernel size reduced in 16 bytes and RACCT kernel in 336 bytes. Suggested by: alc Reviewed by: alc Approved by: kib (mentor) MFC after: 1 week
* - Fix locked memory accounting for maps with MAP_WIREFUTURE flag.zont2012-12-181-1/+32
| | | | | | | | - Add sysctl vm.old_mlock which may turn such accounting off. Reviewed by: avg, trasz Approved by: kib (mentor) MFC after: 1 week
* Control the execution permission of the readable segments forkib2011-10-151-1/+1
| | | | | | | i386 binaries on the amd64 and ia64 with the sysctl, instead of unconditionally enabling it. Reviewed by: marcel
* In sys_obreak() and when compiling for amd64 or ia64, when the processmarcel2011-10-131-2/+12
| | | | | is ILP32 (i.e. i386) grant execute permissions by default. The JDK 1.4.x depends on being able to execute from the heap on i386.
* In order to maximize the re-usability of kernel code in user space thiskmacy2011-09-161-2/+2
| | | | | | | | | | | | | patch modifies makesyscalls.sh to prefix all of the non-compatibility calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel entry points and all places in the code that use them. It also fixes an additional name space collision between the kernel function psignal and the libc function of the same name by renaming the kernel psignal kern_psignal(). By introducing this change now we will ease future MFCs that change syscalls. Reviewed by: rwatson Approved by: re (bz)
* All the racct_*() calls need to happen with the proc locked. Fixing thistrasz2011-07-061-0/+6
| | | | | | won't happen before 9.0. This commit adds "#ifdef RACCT" around all the "PROC_LOCK(p); racct_whatever(p, ...); PROC_UNLOCK(p)" instances, in order to avoid useless locking/unlocking in kernels built without "options RACCT".
* Add accounting for most of the memory-related resources.trasz2011-04-051-0/+25
| | | | | Sponsored by: The FreeBSD Foundation Reviewed by: kib (earlier version)
* Remove execute permission from the memory allocated by sbrk().alc2009-04-111-1/+1
| | | | | | Pre-announced on: -arch (3/31/09) Discussed with: rwatson Tested by: marius (sparc64)
* Revert the addition of the freelist argument for the vm_map_delete()kib2009-02-241-4/+1
| | | | | | | | | function, done in r188334. Instead, collect the entries that shall be freed, in the deferred_freelist member of the map. Automatically purge the deferred freelist when map is unlocked. Tested by: pho Reviewed by: alc
* Do not call vm_object_deallocate() from vm_map_delete(), because wekib2009-02-081-1/+4
| | | | | | | | | | hold the map lock there, and might need the vnode lock for OBJT_VNODE objects. Postpone object deallocation until caller of vm_map_delete() drops the map lock. Link the map entries to be freed into the freelist, that is released by the new helper function vm_map_entry_free_freelist(). Reviewed by: tegge, alc Tested by: pho
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Remove advertising clause from University of California Regent's license,imp2004-04-061-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core
* Locking for the per-process resource limits structure.jhb2004-02-041-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - struct plimit includes a mutex to protect a reference count. The plimit structure is treated similarly to struct ucred in that is is always copy on write, so having a reference to a structure is sufficient to read from it without needing a further lock. - The proc lock protects the p_limit pointer and must be held while reading limits from a process to keep the limit structure from changing out from under you while reading from it. - Various global limits that are ints are not protected by a lock since int writes are atomic on all the archs we support and thus a lock wouldn't buy us anything. - All accesses to individual resource limits from a process are abstracted behind a simple lim_rlimit(), lim_max(), and lim_cur() API that return either an rlimit, or the current or max individual limit of the specified resource from a process. - dosetrlimit() was renamed to kern_setrlimit() to match existing style of other similar syscall helper functions. - The alpha OSF/1 compat layer no longer calls getrlimit() and setrlimit() (it didn't used the stackgap when it should have) but uses lim_rlimit() and kern_setrlimit() instead. - The svr4 compat no longer uses the stackgap for resource limits calls, but uses lim_rlimit() and kern_setrlimit() instead. - The ibcs2 compat no longer uses the stackgap for resource limits. It also no longer uses the stackgap for accessing sysctl's for the ibcs2_sysconf() syscall but uses kernel_sysctl() instead. As a result, ibcs2_sysconf() no longer needs Giant. - The p_rlimit macro no longer exists. Submitted by: mtm (mostly, I only did a few cleanups and catchups) Tested on: i386 Compiled on: alpha, amd64
* Add the mlockall() and munlockall() system calls.bms2003-08-111-0/+21
| | | | | | | | | | | | | | | | | | | | | | | - All those diffs to syscalls.master for each architecture *are* necessary. This needed clarification; the stub code generation for mlockall() was disabled, which would prevent applications from linking to this API (suggested by mux) - Giant has been quoshed. It is no longer held by the code, as the required locking has been pushed down within vm_map.c. - Callers must specify VM_MAP_WIRE_HOLESOK or VM_MAP_WIRE_NOHOLES to express their intention explicitly. - Inspected at the vmstat, top and vm pager sysctl stats level. Paging-in activity is occurring correctly, using a test harness. - The RES size for a process may appear to be greater than its SIZE. This is believed to be due to mappings of the same shared library page being wired twice. Further exploration is needed. - Believed to back out of allocations and locks correctly (tested with WITNESS, MUTEX_PROFILING, INVARIANTS and DIAGNOSTIC). PR: kern/43426, standards/54223 Reviewed by: jake, alc Approved by: jake (mentor) MFC after: 2 weeks
* Use __FBSDID().obrien2003-06-111-1/+3
|
* Use the fields in the sysentvec and in the vm map header in place of thejake2002-09-211-1/+1
| | | | | | | | constants VM_MIN_ADDRESS, VM_MAXUSER_ADDRESS, USRSTACK and PS_STRINGS. This is mainly so that they can be variable even for the native abi, based on different machine types. Get stack protections from the sysentvec too. This makes it trivial to map the stack non-executable for certain abis, on machines that support it.
* Part I of RLIMIT_VMEM implementation. Implement core functionality fordillon2002-06-261-0/+5
| | | | | | | | | | | | a new resource limit that covers a process's entire VM space, including mmap()'d space. (Part II will be additional code to check RLIMIT_VMEM during exec() but it needs more fleshing out). PR: kern/18209 Submitted by: Andrey Alekseyev <uitm@zenon.net>, Dmitry Kim <jason@nichego.net> MFC after: 7 days
* o Remove an incorrect cast from obreak(). This cast would,alc2002-06-201-5/+5
| | | | | | | | | | | for example, break an sbrk(>=4GB) on 64-bit architectures even if the resource limit allowed it. o Correct an off-by-one error. o Correct a spelling error in a comment. o Reorder an && expression so that the commonly FALSE expression comes first. Submitted by: bde (bullets 1 and 2)
* o Acquire and release the vm_map lock instead of Giant in obreak().alc2002-06-201-11/+7
| | | | | | Consequently, use vm_map_insert() and vm_map_delete(), which expect the vm_map to be locked, instead of vm_map_find() and vm_map_remove(), which do not.
* Garbage-collect options ACPI_NO_ENABLE_ON_BOOT, AML_DEBUG, BLEED,bde2002-02-151-1/+0
| | | | | DEVICE_SYSCTLS, KEY, LOUTB, NFS_MUIDHASHSIZ, NFS_UIDHASHSIZ, PCI_QUIET and SIMPLELOCK_DEBUG.
* KSE Milestone 2julian2001-09-121-6/+6
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* mark obreak() and ovadvise() as being MPSAFEdillon2001-08-311-0/+6
|
* whitespace / register cleanupdillon2001-07-041-1/+1
|
* With Alfred's permission, remove vm_mtx in favor of a fine-grained approachdillon2001-07-041-24/+22
| | | | | | | | | (this commit is just the first stage). Also add various GIANT_ macros to formalize the removal of Giant, making it easy to test in a more piecemeal fashion. These macros will allow us to test fine-grained locks to a degree before removing Giant, and also after, and to remove Giant in a piecemeal fashion via sysctl's on those subsystems which the authors believe can operate without Giant.
* Stick VM syscalls back under Giant if the BLEED option is not defined.jhb2001-05-241-0/+8
|
* Acquire Giant around vm_map_remove() inside of the obreak() syscall forjhb2001-05-231-2/+7
| | | | vm_object_terminate().
* Remove duplicate include and sort includes.jhb2001-05-221-3/+2
|
* Introduce a global lock for the vm subsystem (vm_mtx).alfred2001-05-191-0/+7
| | | | | | | | | | | | | | | | | | | vm_mtx does not recurse and is required for most low level vm operations. faults can not be taken without holding Giant. Memory subsystems can now call the base page allocators safely. Almost all atomic ops were removed as they are covered under the vm mutex. Alpha and ia64 now need to catch up to i386's trap handlers. FFS and NFS have been tested, other filesystems will need minor changes (grabbing the vm lock when twiddling page properties). Reviewed (partially) by: jake, jhb
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-1/+1
| | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
* If a process is over its resource limit for datasize, still allowdwmalone2000-10-061-3/+7
| | | | | | | | it to lower its memory usage. This was mentioned on the mailing lists ages ago, and I've lost the name of the person who brought it up. Reviewed by: alc
* Revert spelling mistake I made in the previous commitcharnier2000-03-271-1/+1
| | | | Requested by: Alan and Bruce
* Spellingcharnier2000-03-261-1/+1
|
* Remove unused #include's.alc1999-11-071-1/+0
| | | | Submitted by: phk
* useracc() the prequel:phk1999-10-291-1/+0
| | | | | | | | | | | Merge the contents (less some trivial bordering the silly comments) of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>. This puts the #defines for the vm_inherit_t and vm_prot_t types next to their typedefs. This paves the road for the commit to follow shortly: change useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE} as argument.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Removed ENOMEM error on swap_pager_full condition which ignored thedillon1999-02-221-4/+2
| | | | | | | availability of physical memory. As per original bug report by Bruce. Reviewed by: Alan Cox <alc@cs.rice.edu>
* Addendum to vm_map coalesce optimization. Also, this was backed-outdillon1999-02-091-1/+1
| | | | | | because there was a concensus on current in regards to leaving bss r+w+x instead of r+w. This is in order to maintain reasonable compatibility with existing JIT compilers (e.g. kaffe) and possibly other programs.
* Backed out vm_map coalesce optimization - it resulted in 22% more pagedillon1999-02-081-2/+2
| | | | | | faults for reasons unknown ( under investigation ). /usr/bin/time -l make in /usr/src/bin went from 67000 faults to 90000 faults.
* The elf loader sets the permissions on bss to VM_PROT_READ|VM_PROT_WRITEdillon1999-02-051-2/+2
| | | | | | | | | | | | | rather then VM_PROT_ALL. obreak, on the otherhand, uses VM_PROT_ALL. This prevents vm_map_insert() from being able to coalesce the heap and creates an extra map entry. Since current architectures ignore VM_PROT_EXECUTE anyway, and since not having VM_PROT_EXECUTE on data/bss may provide protection in the future, obreak now uses read+write rather then all (r+w+x). This is an optimization, not a bug fix. Submitted by: Alan Cox <alc@cs.rice.edu>
* Fixed two potentially serious classes of bugs:dg1998-10-131-2/+2
| | | | | | | | | | | | | | | | 1) The vnode pager wasn't properly tracking the file size due to "size" being page rounded in some cases and not in others. This sometimes resulted in corrupted files. First noticed by Terry Lambert. Fixed by changing the "size" pager_alloc parameter to be a 64bit byte value (as opposed to a 32bit page index) and changing the pagers and their callers to deal with this properly. 2) Fixed a bogus type cast in round_page() and trunc_page() that caused some 64bit offsets and sizes to be scrambled. Removing the cast required adding casts at a few dozen callers. There may be problems with other bogus casts in close-by macros. A quick check seemed to indicate that those were okay, however.
* Move the "retval" (3rd) parameter from all syscall functions and putphk1997-11-061-5/+3
| | | | | | | | | | | | it in struct proc instead. This fixes a boatload of compiler warning, and removes a lot of cruft from the sources. I have not removed the /*ARGSUSED*/, they will require some looking at. libkvm, ps and other userland struct proc frobbing programs will need recompiled.
* Removed unused #includes.bde1997-08-021-2/+1
|
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* This is the kernel Lite/2 commit. There are some requisite userlanddyson1997-02-101-1/+1
| | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Fix some serious problems with limits checking in the sbrk(2)/brk(2)dyson1996-06-251-13/+25
| | | | | code. Reviewed by: bde
* Eliminated many redundant vm_map_lookup operations for vm_mmap.dyson1996-01-191-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Speed up for vfs_bio -- addition of a routine bqrelse to greatly diminish overhead for merged cache. Efficiency improvement for vfs_cluster. It used to do alot of redundant calls to cluster_rbuild. Correct the ordering for vrele of .text and release of credentials. Use the selective tlb update for 486/586/P6. Numerous fixes to the size of objects allocated for files. Additionally, fixes in the various pagers. Fixes for proper positioning of vnode_pager_setsize in msdosfs and ext2fs. Fixes in the swap pager for exhausted resources. The pageout code will not as readily thrash. Change the page queue flags (PG_ACTIVE, PG_INACTIVE, PG_FREE, PG_CACHE) into page queue indices (PQ_ACTIVE, PQ_INACTIVE, PQ_FREE, PQ_CACHE), thereby improving efficiency of several routines. Eliminate even more unnecessary vm_page_protect operations. Significantly speed up process forks. Make vm_object_page_clean more efficient, thereby eliminating the pause that happens every 30seconds. Make sequential clustered writes B_ASYNC instead of B_DELWRI even in the case of filesystems mounted async. Fix a panic with busy pages when write clustering is done for non-VMIO buffers.
* Untangled the vm.h include file spaghetti.dg1995-12-071-1/+5
|
* Included <sys/sysproto.h> to get central declarations for syscall argsbde1995-11-121-1/+6
| | | | | | | | | | structs and prototypes for syscalls. Ifdefed duplicated decentralized declarations of args structs. It's convenient to have this visible but they are hard to maintain. Some are already different from the central declarations. 4.4lite2 puts them in comments in the function headers but I wanted to avoid the large changes for that.
OpenPOWER on IntegriCloud