summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_mmap.c
Commit message (Collapse)AuthorAgeFilesLines
* Use the fields in the sysentvec and in the vm map header in place of thejake2002-09-211-25/+12
| | | | | | | | 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.
* - Hold a lock on the vnode acquired from the file table across the call tojeff2002-07-061-3/+14
| | | | | | vm_mmap() as well as the GETATTR etc. - If the handle is a vnode in vm_mmap() assert that it is locked. - Wiggle Giant around a little to account for the extra vnode operation.
* Part I of RLIMIT_VMEM implementation. Implement core functionality fordillon2002-06-261-0/+7
| | | | | | | | | | | | 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 the unnecessary acquisition and release of Giant around fdrop()alc2002-06-231-2/+3
| | | | in mmap(2).
* o Reduce the scope of Giant in vm_mmap() to just the code that manipulatesalc2002-06-221-4/+2
| | | | a vnode. (Thus, MAP_ANON and MAP_STACK never acquire Giant.)
* o Remove GIANT_REQUIRED from vm_fault_user_wire().alc2002-06-161-2/+0
| | | | | | o Move pmap_pageable() outside of Giant in vm_fault_unwire(). (pmap_pageable() is a no-op on all supported architectures.) o Remove the acquisition and release of Giant from mlock().
* o Remove the acquisition and release of Giant from munlock().alc2002-06-151-2/+0
| | | | Reviewed by: tegge
* o Use vm_map_wire() and vm_map_unwire() in place of vm_map_pageable() andalc2002-06-141-3/+3
| | | | | | | | | vm_map_user_pageable(). o Remove vm_map_pageable() and vm_map_user_pageable(). o Remove vm_map_clear_recursive() and vm_map_set_recursive(). (They were only used by vm_map_pageable() and vm_map_user_pageable().) Reviewed by: tegge
* fix typo in _SYS_SYSPROTO_H_ case: s/mlockall_args/munlockall_argsalfred2002-06-061-1/+1
| | | | Submitted by: Mark Santcroos <marks@ripe.net>
* Check for defined(__i386__) instead of just defined(i386) since the compileralfred2002-05-301-3/+3
| | | | will be updated to only define(__i386__) for ANSI cleanliness.
* o Acquire and release Giant around pmap operations in vm_fault_unwire()alc2002-05-261-2/+0
| | | | | | | and vm_map_delete(). Assert GIANT_REQUIRED in vm_map_delete() only if operating on the kernel_object or the kmem_object. o Remove GIANT_REQUIRED from vm_map_remove(). o Remove the acquisition and release of Giant from munmap().
* o Eliminate the acquisition and release of Giant from minherit(2).alc2002-05-181-7/+2
| | | | (vm_map_inherit() no longer requires Giant to be held.)
* o Remove GIANT_REQUIRED from vm_map_madvise(). Instead, acquire andalc2002-05-181-5/+4
| | | | | | | release Giant around vm_map_madvise()'s call to pmap_object_init_pt(). o Replace GIANT_REQUIRED in vm_object_madvise() with the acquisition and release of Giant. o Remove the acquisition and release of Giant from madvise().
* o Remove the acquisition and release of Giant from mprotect().alc2002-05-181-6/+2
|
* o Remove GIANT_REQUIRED from vm_map_lookup_entry() andalc2002-05-041-4/+3
| | | | | vm_map_check_protection(). o Call vm_map_check_protection() without Giant held in munmap().
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-3/+3
| | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
* Remove __P.alfred2002-03-191-1/+1
|
* - Remove a number of extra newlines that do not belong here according toeivind2002-03-101-10/+8
| | | | | | | | | style(9) - Minor space adjustment in cases where we have "( ", " )", if(), return(), while(), for(), etc. - Add /* SYMBOL */ after a few #endifs. Reviewed by: alc
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-271-3/+3
| | | | reference.
* 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.
* Replace ffind_* with fget calls.alfred2002-01-141-4/+1
| | | | | | | | Make fget MPsafe. Make fgetvp and fgetsock use the fget subsystem to reduce code bloat. Push giant down in fpathconf().
* SMP Lock struct file, filedesc and the global file list.alfred2002-01-131-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Seigo Tanimura (tanimura) posted the initial delta. I've polished it quite a bit reducing the need for locking and adapting it for KSE. Locks: 1 mutex in each filedesc protects all the fields. protects "struct file" initialization, while a struct file is being changed from &badfileops -> &pipeops or something the filedesc should be locked. 1 mutex in each struct file protects the refcount fields. doesn't protect anything else. the flags used for garbage collection have been moved to f_gcflag which was the FILLER short, this doesn't need locking because the garbage collection is a single threaded container. could likely be made to use a pool mutex. 1 sx lock for the global filelist. struct file * fhold(struct file *fp); /* increments reference count on a file */ struct file * fhold_locked(struct file *fp); /* like fhold but expects file to locked */ struct file * ffind_hold(struct thread *, int fd); /* finds the struct file in thread, adds one reference and returns it unlocked */ struct file * ffind_lock(struct thread *, int fd); /* ffind_hold, but returns file locked */ I still have to smp-safe the fget cruft, I'll get to that asap.
* Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loaderps2001-10-101-3/+2
| | | | | | | tunable. Reviewed by: peter MFC after: 2 weeks
* o Modify access control checks in mmap() to use securelevel_gt() insteadrwatson2001-09-261-1/+1
| | | | | | of direct variable access. Obtained from: TrustedBSD Project
* KSE Milestone 2julian2001-09-121-56/+56
| | | | | | | | | | | | | | 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
* Cleanupdillon2001-08-311-27/+68
|
* Remove support for the badly broken MAP_INHERIT (from -current only).dillon2001-08-241-4/+1
|
* whitespace / register cleanupdillon2001-07-041-15/+15
|
* With Alfred's permission, remove vm_mtx in favor of a fine-grained approachdillon2001-07-041-67/+19
| | | | | | | | | (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/+49
|
* - Obtain Giant in mmap() syscall while messing with file descriptors andjhb2001-05-231-18/+32
| | | | | | | | | | | vnodes. - Fix an old bug that would leak a reference to a fd if the vnode being mmap'd wasn't of type VREG or VCHR. - Lock Giant in vm_mmap() around calls into the VM that can call into pager routines that need Giant or into other VM routines that need Giant. - Replace code that used a goto to jump around the else branch of a test to use an else branch instead.
* Unlock the VM lock at the end of munlock() instead of locking it again.jhb2001-05-221-1/+1
|
* Introduce a global lock for the vm subsystem (vm_mtx).alfred2001-05-191-11/+49
| | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | | | | | | | 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)
* This patchset fixes a large number of file descriptor race conditions.dillon2000-11-181-15/+37
| | | | | | | | | | | | Pre-rfork code assumed inherent locking of a process's file descriptor array. However, with the advent of rfork() the file descriptor table could be shared between processes. This patch closes over a dozen serious race conditions related to one thread manipulating the table (e.g. closing or dup()ing a descriptor) while another is blocked in an open(), close(), fcntl(), read(), write(), etc... PR: kern/11629 Discussed with: Alexander Viro <viro@math.psu.edu>
* Add three new VOPs: VOP_CREATEVOBJECT, VOP_DESTROYVOBJECT and VOP_GETVOBJECT.bp2000-09-121-0/+9
| | | | | | | They will be used by nullfs and other stacked filesystems to support full cache coherency. Reviewed in general by: mckusick, dillon
* Clean up the snapshot code so that it no longer depends on the use ofmckusick2000-07-261-1/+1
| | | | | | | | | | | | | | the SF_IMMUTABLE flag to prevent writing. Instead put in explicit checking for the SF_SNAPSHOT flag in the appropriate places. With this change, it is now possible to rename and link to snapshot files. It is also possible to set or clear any of the owner, group, or other read bits on the file, though none of the write or execute bits can be set. There is also an explicit test to prevent the setting or clearing of the SF_SNAPSHOT flag via chflags() or fchflags(). Note also that the modify time cannot be changed as it needs to accurately reflect the time that the snapshot was taken. Submitted by: Robert Watson <rwatson@FreeBSD.org>
* Nifty idea from Jeroen van Gelderen; don't call a routine to check ifmarkm2000-06-251-1/+2
| | | | | | we are using the /dev/zero device, just check a flag (supplied by /dev/zero). Reviewed by: dfr
* Checkpoint of a new physical memory backed object type, that does notpeter2000-05-211-1/+1
| | | | | | | | | | | | | have pv_entries. This is intended for very special circumstances, eg: a certain database that has a 1GB shm segment mapped into 300 processes. That would consume 2GB of kvm just to hold the pv_entries alone. This would not be used on systems unless the physical ram was available, as it's not pageable. This is a work-in-progress, but is a useful and functional checkpoint. Matt has got some more fixes for it that will be committed soon. Reviewed by: dillon
* Implement an optimization of the VM<->pmap API. Pass vm_page_t's directlypeter2000-05-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to various pmap_*() functions instead of looking up the physical address and passing that. In many cases, the first thing the pmap code was doing was going to a lot of trouble to get back the original vm_page_t, or it's shadow pv_table entry. Inspired by: John Dyson's 1998 patches. Also: Eliminate pv_table as a seperate thing and build it into a machine dependent part of vm_page_t. This eliminates having a seperate set of structions that shadow each other in a 1:1 fashion that we often went to a lot of trouble to translate from one to the other. (see above) This happens to save 4 bytes of physical memory for each page in the system. (8 bytes on the Alpha). Eliminate the use of the phys_avail[] array to determine if a page is managed (ie: it has pv_entries etc). Store this information in a flag. Things like device_pager set it because they create vm_page_t's on the fly that do not have pv_entries. This makes it easier to "unmanage" a page of physical memory (this will be taken advantage of in subsequent commits). Add a function to add a new page to the freelist. This could be used for reclaiming the previously wasted pages left over from preloaded loader(8) files. Reviewed by: dillon
* Implement POSIX.1b shared memory objects. In this implementation,wollman2000-04-221-0/+10
| | | | | | | | shared memory objects are regular files; the shm_open(3) routine uses fcntl(2) to set a flag on the descriptor which tells mmap(2) to automatically apply MAP_NOSYNC. Not objected to by: bde, dillon, dufault, jasone
* Revert spelling mistake I made in the previous commitcharnier2000-03-271-1/+1
| | | | Requested by: Alan and Bruce
* Spellingcharnier2000-03-261-1/+1
|
* Add MAP_NOCORE to mmap(2), and MADV_NOCORE and MADV_CORE to madvise(2).ps2000-02-281-1/+3
| | | | | | | | | | | | This This feature allows you to specify if mmap'd data is included in an application's corefile. Change the type of eflags in struct vm_map_entry from u_char to vm_eflags_t (an unsigned int). Reviewed by: dillon,jdp,alfred Approved by: jkh
* Fix null-pointer dereference crash when the system is intentionallydillon2000-02-161-4/+42
| | | | | | | | | | | | | | | | run out of KVM through a mmap()/fork() bomb that allocates hundreds of thousands of vm_map_entry structures. Add panic to make null-pointer dereference crash a little more verbose. Add a new sysctl, vm.max_proc_mmap, which specifies the maximum number of mmap()'d spaces (discrete vm_map_entry's in the process). The value defaults to around 9000 for a 128MB machine. The test is scaled for the number of processes sharing a vmspace (aka linux threads). Setting the value to 0 disables the feature. PR: kern/16573 Approved by: jkh
* Use MAP_NOSYNC for vnodes without any links in their filesystem.guido2000-01-031-0/+7
| | | | | | | | | This is necessary for vmware: it does not use an anonymous mmap for the memory of the virtual system. In stead it creates a temp file an unlinks it. For a 50 MB file, this results in a ot of syncing every 30 seconds. Reviewed by: Matthew Dillon <dillon@backplane.com>
* Add MAP_NOSYNC feature to mmap(), and MADV_NOSYNC and MADV_AUTOSYNC todillon1999-12-121-3/+4
| | | | | | | | | | | | | | | | | madvise(). This feature prevents the update daemon from gratuitously flushing dirty pages associated with a mapped file-backed region of memory. The system pager will still page the memory as necessary and the VM system will still be fully coherent with the filesystem. Modifications made by other means to the same area of memory, for example by write(), are unaffected. The feature works on a page-granularity basis. MAP_NOSYNC allows one to use mmap() to share memory between processes without incuring any significant filesystem overhead, putting it in the same performance category as SysV Shared memory and anonymous memory. Reviewed by: julian, alc, dg
* useracc() the prequel:phk1999-10-291-2/+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.
* cleanup madvise code, add a few more sanity checks.dillon1999-09-211-2/+17
| | | | Reviewed by: Alan Cox <alc@cs.rice.edu>, dg@root.com
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
OpenPOWER on IntegriCloud