summaryrefslogtreecommitdiffstats
path: root/sys/vm
Commit message (Collapse)AuthorAgeFilesLines
* Do not copy vm_exitingcnt to the new vmspace in vmspace_exec(). Copyingtjr2004-03-231-1/+2
| | | | | it led to impossibly high values in the new vmspace, causing it to never drop to 0 and be freed.
* When mmap-ing a file from a noexec mount, be sure not to grant the rightguido2004-03-181-1/+5
| | | | | | | | to mmap it PROT_EXEC. This also depends on the architecture, as some architextures (e.g. i386) do not distinguish between read and exec pages Inspired by: http://linux.bkbits.net:8080/linux-2.4/cset@1.1267.1.85 Reviewed by: alc
* Make overflow/wraparound checking more robust and unbreak len=0 intruckman2004-03-152-16/+22
| | | | | | vslock(), mlock(), and munlock(). Reviewed by: bde
* Style(9) changes.truckman2004-03-152-40/+11
| | | | Pointed out by: bde
* Revert to the original vslock() and vsunlock() API with the followingtruckman2004-03-152-33/+25
| | | | | | | | | exceptions: Retain the recently added vslock() error return. The type of the len argument should be size_t, not u_int. Suggested by: bde
* Remove redundant suser() check.truckman2004-03-151-4/+0
|
* Remove GIANT_REQUIRED from contigfree().alc2004-03-131-1/+1
|
* Part 2 of rev 1.68. Update comment to match reality now that vm_endcopypeter2004-03-121-1/+1
| | | | | | exists and we no longer copy to the end of the struct. Forgotten by: alfred and green
* - Make the acquisition of Giant in vm_fault_unwire() conditional on thealc2004-03-102-13/+5
| | | | | | | | | | | | pmap. For the kernel pmap, Giant is not required. In general, for other pmaps, Giant is required by i386's pmap_pte() implementation. Specifically, the use of PMAP2/PADDR2 is synchronized by Giant. Note: In principle, updates to the kernel pmap's wired count could be lost without Giant. However, in practice, we never use the kernel pmap's wired count. This will be resolved when pmap locking appears. - With the above change, cpu_thread_clean() and uma_large_free() need not acquire Giant. (The first case is simply the revival of i386/i386/vm_machdep.c's revision 1.226 by peter.)
* Implement a work around for the deadlock avoidance case inalc2004-03-081-0/+7
| | | | | | vm_object_deallocate() so that it doesn't spin forever either. Submitted by: bde
* Retire pmap_pinit2(). Alpha was the last platform that used it. However,alc2004-03-073-6/+0
| | | | | | | | | | | | | | ever since alpha/alpha/pmap.c revision 1.81 introduced the list allpmaps, there has been no reason for having this function on Alpha. Briefly, when pmap_growkernel() relied upon the list of all processes to find and update the various pmaps to reflect a growth in the kernel's valid address space, pmap_init2() served to avoid a race between pmap initialization and pmap_growkernel(). Specifically, pmap_pinit2() was responsible for initializing the kernel portions of the pmap and pmap_pinit2() was called after the process structure contained a pointer to the new pmap for use by pmap_growkernel(). Thus, an update to the kernel's address space might be applied to the new pmap unnecessarily, but an update would never be lost.
* Mark uma_callout as CALLOUT_MPSAFE, as uma_timeout can run MPSAFE.rwatson2004-03-071-1/+1
| | | | Reviewed by: jeff
* Undo the merger of mlock()/vslock and munlock()/vsunlock() and thetruckman2004-03-053-50/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | introduction of kern_mlock() and kern_munlock() in src/sys/kern/kern_sysctl.c 1.150 src/sys/vm/vm_extern.h 1.69 src/sys/vm/vm_glue.c 1.190 src/sys/vm/vm_mmap.c 1.179 because different resource limits are appropriate for transient and "permanent" page wiring requests. Retain the kern_mlock() and kern_munlock() API in the revived vslock() and vsunlock() functions. Combine the best parts of each of the original sets of implementations with further code cleanup. Make the mclock() and vslock() implementations as similar as possible. Retain the RLIMIT_MEMLOCK check in mlock(). Move the most strigent test, which can return EAGAIN, last so that requests that have no hope of ever being satisfied will not be retried unnecessarily. Disable the test that can return EAGAIN in the vslock() implementation because it will cause the sysctl code to wedge. Tested by: Cy Schubert <Cy.Schubert AT komquats.com>
* In the last revision, I introduced a physical contiguity check that is bothalc2004-03-051-3/+1
| | | | | | | | | | unnecessary and wrong. While it is necessary to verify that the page is still free after dropping and reacquiring the free page queue lock, the physical contiguity of the page can not change, making this check unnecessary. This check was wrong in that it could cause an out-of-bounds array access. Tested by: rwatson
* Record exactly where this file was copied from. It wasn't repo-copied sobde2004-03-041-12/+12
| | | | | | this is not very obvious. Fixed some style bugs (mainly missing parentheses around return values).
* Minor style fixes. In vm_daemon(), don't fetch the rss limit long beforebde2004-03-041-9/+8
| | | | it is needed.
* Remove some long unused definitions.alc2004-03-041-2/+0
|
* Modify contigmalloc1() so that the free page queues lock is not held whenalc2004-03-022-4/+15
| | | | | | vm_page_free() is called. The problem with holding this lock is that it is a spin lock and vm_page_free() may attempt the acquisition of a different default-type lock.
* Pich up a do {} while(0) cleanup by phk that was discarded accidentally inkan2004-03-011-11/+9
| | | | | | previous revision. Submitted by: alc
* Move the code dealing with vnode out of several functions into a singlekan2004-02-271-156/+136
| | | | | | helper function vm_mmap_vnode. Discussed with: jeffr,alc (a while ago)
* Split the mlock() kernel code into two parts, mlock(), which unpackstruckman2004-02-263-55/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the syscall arguments and does the suser() permission check, and kern_mlock(), which does the resource limit checking and calls vm_map_wire(). Split munlock() in a similar way. Enable the RLIMIT_MEMLOCK checking code in kern_mlock(). Replace calls to vslock() and vsunlock() in the sysctl code with calls to kern_mlock() and kern_munlock() so that the sysctl code will obey the wired memory limits. Nuke the vslock() and vsunlock() implementations, which are no longer used. Add a member to struct sysctl_req to track the amount of memory that is wired to handle the request. Modify sysctl_wire_old_buffer() to return an error if its call to kern_mlock() fails. Only wire the minimum of the length specified in the sysctl request and the length specified in its argument list. It is recommended that sysctl handlers that use sysctl_wire_old_buffer() should specify reasonable estimates for the amount of data they want to return so that only the minimum amount of memory is wired no matter what length has been specified by the request. Modify the callers of sysctl_wire_old_buffer() to look for the error return. Modify sysctl_old_user to obey the wired buffer length and clean up its implementation. Reviewed by: bms
* - Substitute bdone() and bwait() from vfs_bio.c foralc2004-02-231-23/+4
| | | | | | | | | | swap_pager_putpages()'s buffer completion code. Note: the only difference between swp_pager_sync_iodone() and bdone(), aside from the locking in the latter, was the unnecessary clearing of B_ASYNC. - Remove an unnecessary pmap_page_protect() from swp_pager_async_iodone(). Reviewed by: tegge
* Correct a long-standing race condition in vm_object_page_remove() thatalc2004-02-221-1/+1
| | | | | | | could result in a dirty page being unintentionally freed. Reviewed by: tegge MFC after: 7 days
* Eliminate the second, unnecessary call to pmap_page_protect() near the endalc2004-02-211-2/+4
| | | | | | | of vm_pageout_flush(). Instead, assert that the page is still write protected. Discussed with: tegge
* - Correct a long-standing race condition in vm_page_try_to_free() thatalc2004-02-191-4/+3
| | | | | | | | could result in a dirty page being unintentionally freed. - Simplify the dirty page check in vm_page_dontneed(). Reviewed by: tegge MFC after: 7 days
* Back out previous commit due to objections.des2004-02-161-2/+0
|
* Don't panic if we fail to satisfy an M_WAITOK request; return 0 instead.des2004-02-161-0/+2
| | | | The calling code will either handle that gracefully or cause a page fault.
* Correct a long-standing race condition in vm_contig_launder() that couldalc2004-02-161-0/+2
| | | | | | | | | result in a panic "vm_page_cache: caching a dirty page, ...": Access to the page must be restricted or removed before calling vm_page_cache(). This race condition is identical in nature to that which was addressed by vm_pageout.c's revision 1.251 and vm_page.c's revision 1.275. MFC after: 7 days
* Correct a long-standing race condition in vm_fault() that could result in aalc2004-02-151-3/+1
| | | | | | | | | | panic "vm_page_cache: caching a dirty page, ...": Access to the page must be restricted or removed before calling vm_page_cache(). This race condition is identical in nature to that which was addressed by vm_pageout.c's revision 1.251 and vm_page.c's revision 1.275. Reviewed by: tegge MFC after: 7 days
* - Correct a long-standing race condition in vm_page_try_to_cache() thatalc2004-02-142-4/+3
| | | | | | | | | | | | could result in a panic "vm_page_cache: caching a dirty page, ...": Access to the page must be restricted or removed before calling vm_page_cache(). This race condition is identical in nature to that which was addressed by vm_pageout.c's revision 1.251. - Simplify the code surrounding the fix to this same race condition in vm_pageout.c's revision 1.251. There should be no behavioral change. Reviewed by: tegge MFC after: 7 days
* Remove the absolute count g_access_abs() function since experience hasphk2004-02-121-2/+2
| | | | | | | | | | | | shown that it is not useful. Rename the relative count g_access_rel() function to g_access(), only the name has changed. Change all g_access_rel() calls in our CVS tree to call g_access() instead. Add an #ifndef BURN_BRIDGES #define of g_access_rel() for source code compatibility.
* Further reduce the use of Giant in vm_map_delete(): Perform pmap_remove()alc2004-02-121-2/+2
| | | | | | on system maps, besides the kmem_map, without Giant. In collaboration with: tegge
* Correct a long-standing race condition in the inactive queue scan. (Seealc2004-02-101-0/+15
| | | | | | | | the added comment for low-level details.) The effect of this race condition is a panic "vm_page_cache: caching a dirty page, ..." Reviewed by: tegge MFC after: 7 days
* swp_pager_async_iodone() no longer requires Giant. Modify bufdone()alc2004-02-071-3/+0
| | | | | | and swapgeom_done() to perform swp_pager_async_iodone() without Giant. Reviewed by: tegge
* - Locking for the per-process resource limits structure has eliminatedalc2004-02-052-5/+1
| | | | | | the need for Giant in vm_map_growstack(). - Use the proc * that is passed to vm_map_growstack() rather than curthread->td_proc.
* Locking for the per-process resource limits structure.jhb2004-02-045-32/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* Drop the reference count on the old vmspace after fully switching thejhb2004-02-021-2/+2
| | | | | | current thread to the new vmspace. Suggested by: dillon
* Check error return from g_clone_bio(). (netchild@)phk2004-02-021-0/+11
| | | | | | Add XXX comment about why this is still not optimal. (phk@) Submitted by: netchild@
* - Use a seperate startup function for the zeroidle kthread. Use this tojeff2004-02-021-10/+23
| | | | set P_NOLOAD prior to running the thread.
* - Fix a problem where we did not drain the cache of buckets in the zonejeff2004-02-011-8/+21
| | | | | | when uma_reclaim() was called. This was introduced when the zone working-set algorithm was removed in favor of using the per cpu caches as the working set.
* Mechanical whitespace cleanup.des2004-01-301-41/+41
|
* Fixed breakage of scheduling in rev.1.29 of subr_4bsd.c. Thebde2004-01-291-1/+1
| | | | | | | | | | | | | | | | | "scheduler" here has very little to do with scheduling. It is actually the swapper, and it really must be the last SYSINIT'ed item like its comment says, since proc0 metamorphoses into swapper by calling scheduler() last in mi_start(), and scheduler() never returns.. Rev.1.29 of subr_4bsd.c broke this by adding another SI_ORDER_FIRST item (kproc_start() for schedcpu_thread() onto the SI_SUB_RUN_SCHEDULER_LIST. The sorting of SYSINITs with identical orders (at all levels) is apparently nondeterministic, so this resulted in schedule() sometimes being called second last and schedcpu_thread() not being called at all. This quick fix just changes the code to almost match the comment (SI_ORDER_FIRST -> SI_ORDER_ANY). "LAST" is misspelled "ANY", and there is no way to ensure that there is only 1 very lst SYSINIT. A more complete fix would remove the SYSINIT obfuscation.
* - Add a flags parameter to mi_switch. The value of flags may be SW_VOL orjeff2004-01-251-2/+1
| | | | | | | | | | SW_INVOL. Assert that one of these is set in mi_switch() and propery adjust the rusage statistics. This is to simplify the large number of users of this interface which were previously all required to adjust the proper counter prior to calling mi_switch(). This also facilitates more switch and locking optimizations. - Change all callers of mi_switch() to pass the appropriate paramter and remove direct references to the process statistics.
* 1. Statically initialize swap_pager_full and swap_pager_almost_full to thealc2004-01-241-2/+6
| | | | | | | | | | | full state. (When swap is added their state will change appropriately.) 2. Set swap_pager_full and swap_pager_almost_full to the full state when the last swap device is removed. Combined these changes eliminate nonsense messages from the kernel on swap- less machines. Item 2 submitted by: Divacky Roman <xdivac02@stud.fit.vutbr.cz> Prodding by: phk
* Increase UMA_BOOT_PAGES because of changes to pv entry initialization inalc2004-01-181-1/+1
| | | | revision 1.457 of i386/i386/pmap.c.
* Don't acquire Giant in vm_object_deallocate() unless the object is vnode-alc2004-01-181-8/+12
| | | | backed.
* Remove vm_page_alloc_contig(). It's now unused.alc2004-01-142-16/+0
|
* Remove long dead code, specifically, code related to munmapfd().alc2004-01-111-1/+0
| | | | (See also vm/vm_mmap.c revision 1.173.)
* - Unmanage pages allocated by contigmalloc1(). (There is no point inalc2004-01-101-6/+2
| | | | | having PV entries for these pages.) - Remove splvm() and splx() calls.
* Unmanage pages allocated by kmem_alloc(). (There is no point in having PValc2004-01-101-0/+1
| | | | entries for these pages.)
OpenPOWER on IntegriCloud