summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_mmap.c
Commit message (Collapse)AuthorAgeFilesLines
* Add a f_vnode field to struct file.phk2003-06-221-1/+1
| | | | | | | | | | | | Several of the subtypes have an associated vnode which is used for stuff like the f*() functions. By giving the vnode a speparate field, a number of checks for the specific subtype can be replaced simply with a check for f_vnode != NULL, and we can later free f_data up to subtype specific use. At this point in time, f_data still points to the vnode, so any code I might have overlooked will still work.
* Use a do {...} while (0); and a couple of breaks to reduce the levelphk2003-06-211-78/+80
| | | | of indentation a bit.
* Use __FBSDID().obrien2003-06-111-1/+3
|
* Hold the vm object's lock when performing vm_page_lookup().alc2003-06-091-0/+2
|
* suser() does not need the proc lock, just the setting of P_PROTECTED injhb2003-04-171-4/+5
| | | | p_flag needs the lock.
* Add a facility allowing processes to inform the VM subsystem they arewes2003-03-311-0/+15
| | | | | | | | critical and should not be killed when pageout is looking for more memory pages in all the wrong places. Reviewed by: arch@ Sponsored by: St. Bernard Software
* The object type can't be OBJT_PHYS in vm_mmap().mux2003-03-301-1/+1
| | | | Reviewed by: peter
* Bow to the whining masses and change a union back into void *. Retaindillon2003-01-131-1/+1
| | | | | removal of unnecessary casts and throw in some minor cleanups to see if anyone complains, just for the hell of it.
* Change struct file f_data to un_data, a union of the correct structdillon2003-01-121-1/+1
| | | | | | | | | | pointer types, and remove a huge number of casts from code using it. Change struct xfile xf_data to xun_data (ABI is still compatible). If we need to add a #define for f_data and xf_data we can, but I don't think it will be necessary. There are no operational changes in this commit.
* Lock page field accesses in mincore().alc2002-11-281-0/+2
| | | | Approved by: re (blanket)
* Invoke mac_check_vnode_mmap() during mmap operations on vnodes,rwatson2002-10-221-2/+12
| | | | | | | | | | permitting policies to restrict access to memory mapping based on the credential requesting the mapping, the target vnode, the requested rights, or other policy considerations. Approved by: re Obtained from: TrustedBSD Project Sponsored by: DARPA, Network Associates Laboratories
* 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
OpenPOWER on IntegriCloud