summaryrefslogtreecommitdiffstats
path: root/sys/vm/swap_pager.c
Commit message (Collapse)AuthorAgeFilesLines
* MFH (r264966): add sysctl OIDs for actual swap zone size and capacitydes2014-05-121-3/+11
|
* Remove the deprecated VM_ALLOC_RETRY flag for the vm_page_grab(9).kib2013-08-221-1/+1
| | | | | | | | The flag was mandatory since r209792, where vm_page_grab(9) was changed to only support the alloc retry semantic. Suggested and reviewed by: alc Sponsored by: The FreeBSD Foundation
* The soft and hard busy mechanism rely on the vm object lock to work.attilio2013-08-091-18/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unify the 2 concept into a real, minimal, sxlock where the shared acquisition represent the soft busy and the exclusive acquisition represent the hard busy. The old VPO_WANTED mechanism becames the hard-path for this new lock and it becomes per-page rather than per-object. The vm_object lock becames an interlock for this functionality: it can be held in both read or write mode. However, if the vm_object lock is held in read mode while acquiring or releasing the busy state, the thread owner cannot make any assumption on the busy state unless it is also busying it. Also: - Add a new flag to directly shared busy pages while vm_page_alloc and vm_page_grab are being executed. This will be very helpful once these functions happen under a read object lock. - Move the swapping sleep into its own per-object flag The KPI is heavilly changed this is why the version is bumped. It is very likely that some VM ports users will need to change their own code. Sponsored by: EMC / Isilon storage division Discussed with: alc Reviewed by: jeff, kib Tested by: gavin, bapt (older version) Tested by: pho, scottl
* When swap pager allocates metadata in the pagedaemon context, allow itkib2013-07-111-1/+2
| | | | | | | | | | to drain the reserve. This was broken in r243040, causing deadlock. Note that VM_WAIT call in case of uma_zalloc() failure from pagedaemon would only wait for the v_pageout_free_min anyway. Reported and tested by: pho Reviewed by: alc Sponsored by: The FreeBSD Foundation
* Fix typo in comment.kib2013-07-091-1/+1
| | | | MFC after: 3 days
* Complete r251452:attilio2013-06-061-2/+3
| | | | | | | | | Avoid to busy/unbusy a page in cases where there is no need to drop the vm_obj lock, more nominally when the page is full valid after vm_page_grab(). Sponsored by: EMC / Isilon storage division Reviewed by: alc
* o Change the locking scheme for swp_bcount.attilio2013-05-281-5/+7
| | | | | | | | | | | It can now be accessed with a write lock on the object containing it OR with a read lock on the object containing it along with the swhash_mtx. o Remove some duplicate assertions for swap_pager_freespace() and swap_pager_unswapped() but keep the object locking references for documentation. Sponsored by: EMC / Isilon storage division Reviewed by: alc
* Do not map the swap i/o pbufs if the geom provider for the swapkib2013-03-191-13/+33
| | | | | | | partition accepts unmapped requests. Sponsored by: The FreeBSD Foundation Tested by: pho
* MFCattilio2013-02-261-2/+1
|
* As VM_OBJECT_SLEEP() is a vm_object_t specific function, makeattilio2013-02-261-1/+1
| | | | | | the passed object as the first argument of the function for consistency. Sponsored by: EMC / Isilon storage revision
* Hide the details for the assertion for VM_OBJECT_LOCK operations.attilio2013-02-211-11/+11
| | | | | | | | Rename current VM_OBJECT_LOCK_ASSERT(foo, RA_WLOCKED) into VM_OBJECT_ASSERT_WLOCKED(foo) Sponsored by: EMC / Isilon storage division Requested by: alc
* Rename VM_OBJECT_LOCK(), VM_OBJECT_UNLOCK() and VM_OBJECT_TRYLOCK() toattilio2013-02-201-25/+25
| | | | | | their "write" versions. Sponsored by: EMC / Isilon storage division
* Switch vm_object lock to be a rwlock.attilio2013-02-201-12/+13
| | | | | | | | * VM_OBJECT_LOCK and VM_OBJECT_UNLOCK are mapped to write operations * VM_OBJECT_SLEEP() is introduced as a general purpose primitve to get a sleep operation using a VM_OBJECT_LOCK() as protection * The approach must bear with vm_pager.h namespace pollution so many files require including directly rwlock.h
* - Don't pass geom and provider names as format strings.jh2012-11-201-1/+1
| | | | | | | - Add __printflike() attributes. - Remove an extra argument for the g_new_geomf() call in swapongeom_ev(). Reviewed by: pjd
* Whitespace cleanup.des2012-09-051-76/+76
|
* No memory barrier is required. This was pointed out by kib@ a while ago,des2012-09-041-2/+2
| | | | | | but I got distracted by other matters. (for real this time)
* Revert previous commit, which was performed in the wrong tree.des2012-09-041-89/+82
|
* No memory barrier is required. This was pointed out by kib@ a while ago,des2012-09-041-82/+89
| | | | but I got distracted by other matters.
* Typo in previous change: print half the theoretical maximum as maximumpluknet2012-08-271-1/+1
| | | | | | | recommended amount. Reported by: <site freebsd at orientalsensation com> Reviewed by: des
* - When running out of swzone, instead of spewing an error message everydes2012-08-161-1/+33
| | | | | | | | tick until the situation is resolved (if ever), just print a single message when running out and another when space becomes available. - When adding more swap, warn if the total amount exceeds half the theoretical maximum we can handle.
* The page flag PGA_WRITEABLE is set and cleared exclusively by the pmapalc2012-06-161-1/+1
| | | | | | | | | | | | | | | | layer, but it is read directly by the MI VM layer. This change introduces pmap_page_is_write_mapped() in order to completely encapsulate all direct access to PGA_WRITEABLE in the pmap layer. Aesthetics aside, I am making this change because amd64 will likely begin using an alternative method to track write mappings, and having pmap_page_is_write_mapped() in place allows me to make such a change without further modification to the MI VM layer. As an added bonus, tidy up some nearby comments concerning page flags. Reviewed by: kib MFC after: 6 weeks
* Revert r236380eadler2012-06-011-15/+0
| | | | | | PR: kern/166780 Requested by: many Approved by: cperciva (implicit)
* Add sysctl to query amount of swap space freeeadler2012-06-011-0/+15
| | | | | | | PR: kern/166780 Submitted by: Radim Kolar <hsn@sendmail.cz> Approved by: cperciva MFC after: 1 week
* Remove direct access to si_name.ed2012-02-101-3/+3
| | | | | | | | Code should just use the devtoname() function to obtain the name of a character device. Also add const keywords to pieces of code that need it to build properly. MFC after: 2 weeks
* Fix NULL dereference panic on attempt to turn off (on system shutdown)mav2012-02-011-1/+1
| | | | | | | | | | | | | disconnected swap device. This is quick and imperfect solution, as swap device will still be opened and GEOM will not be able to destroy it. Proper solution would be to automatically turn off and close disconnected swap device, but with existing code it will cause panic if there is at least one page on device, even if it is unimportant page of the user-level process. It needs some work. Reviewed by: kib@ MFC after: 1 week
* Fix printf.kib2011-12-121-1/+1
| | | | | Submitted by: az MFC after: 1 week
* 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)
* Split the vm_page flags PG_WRITEABLE and PG_REFERENCED into atomickib2011-09-061-1/+1
| | | | | | | | | | | | | | | | | flags field. Updates to the atomic flags are performed using the atomic ops on the containing word, do not require any vm lock to be held, and are non-blocking. The vm_page_aflag_set(9) and vm_page_aflag_clear(9) functions are provided to modify afalgs. Document the changes to flags field to only require the page lock. Introduce vm_page_reference(9) function to provide a stable KPI and KBI for filesystems like tmpfs and zfs which need to mark a page as referenced. Reviewed by: alc, attilio Tested by: marius, flo (sparc64); andreast (powerpc, powerpc64) Approved by: re (bz)
* Update some comments in swap_pager.c.kib2011-08-221-30/+17
| | | | | | Reviewed and most wording by: alc MFC after: 1 week Approved by: re (bz)
* Apply the limit to avoid the overflows in the radix tree subr_blist.ckib2011-08-221-10/+12
| | | | | | | | | | | after the conversion of the swap device size to the page size units, not before. That lifts the limit on the usable swap partition size from 32GB to 256GB, that is less depressing for the modern systems. Submitted by: Alexander V. Chernikov <melifaro ipfw ru> Reviewed by: alc Approved by: re (bz) MFC after: 2 weeks
* Implement the linprocfs swaps file, providing information about thekib2011-08-011-20/+38
| | | | | | | | | | configured swap devices in the Linux-compatible format. Based on the submission by: Robert Millan <rmh debian org> PR: kern/159281 Reviewed by: bde Approved by: re (kensmith) MFC after: 2 weeks
* 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".
* Reap old SPL comments.obrien2011-04-261-35/+2
| | | | Reviewed by: alc
* Add accounting for most of the memory-related resources.trasz2011-04-051-0/+19
| | | | | Sponsored by: The FreeBSD Foundation Reviewed by: kib (earlier version)
* Change the return type of vmspace_swap_count to a long to match the otherbrucec2011-03-011-2/+2
| | | | | | vmspace_*_count functions. MFC after: 3 days
* Calculate and return the count in vmspace_swap_count as a vm_offset_tbrucec2011-02-231-7/+8
| | | | | | | | | | instead of an int to avoid overflow. While here, clean up some style(9) issues. PR: kern/152200 Reviewed by: kib MFC after: 2 weeks
* Move the definition of M_VMPGDATA to the swap pager, where the onlyalc2011-01-181-0/+1
| | | | remaining uses are.
* There can be more than 0x20000000 swap meta blocks allocated if a swap-backedbrucec2011-01-011-4/+0
| | | | | | | | | md(4) device is used. Don't panic when deallocating such a device if swap has been used. PR: kern/133170 Discussed with: kib MFC after: 3 days
* Replace pointer to "struct uidinfo" with pointer to "struct ucred"trasz2010-12-021-16/+18
| | | | | | | | | in "struct vm_object". This is required to make it possible to account for per-jail swap usage. Reviewed by: kib@ Tested by: pho@ Sponsored by: FreeBSD Foundation
* PG_BUSY -> VPO_BUSY, PG_WANTED -> VPO_WANTED in manual pages and commentsavg2010-10-201-2/+2
| | | | | Reviewed by: alc MFC after: 4 days
* Call vm_page_deactivate() rather than vm_page_dontneed() inalc2010-05-091-4/+2
| | | | | | | | | | swp_pager_force_pagein(). By dirtying the page, swp_pager_force_pagein() forces vm_page_dontneed() to insert the page at the head of the inactive queue, just like vm_page_deactivate() does. Moreover, because the page was invalid, it can't have been mapped, and thus the other effect of vm_page_dontneed(), clearing the page's reference bits has no effect. In summary, there is no reason to call vm_page_dontneed() since its effect will be identical to calling the simpler vm_page_deactivate().
* Remove the page queues lock around a call to vm_page_activate(). Make thealc2010-05-091-3/+1
| | | | page dirty before adding it to the active queue.
* Push down the page queues into vm_page_cache(), vm_page_try_to_cache(), andalc2010-05-081-16/+13
| | | | | | | | | | | vm_page_try_to_free(). Consequently, push down the page queues lock into pmap_enter_quick(), pmap_page_wired_mapped(), pmap_remove_all(), and pmap_remove_write(). Push down the page queues lock into Xen's pmap_page_is_mapped(). (I overlooked the Xen pmap in r207702.) Switch to a per-processor counter for the total number of pages cached.
* Eliminate unnecessary page queues locking.alc2010-05-071-4/+0
|
* On Alan's advice, rather than do a wholesale conversion on a singlekmacy2010-04-301-6/+22
| | | | | | | | | | | | architecture from page queue lock to a hashed array of page locks (based on a patch by Jeff Roberson), I've implemented page lock support in the MI code and have only moved vm_page's hold_count out from under page queue mutex to page lock. This changes pmap_extract_and_hold on all pmaps. Supported by: Bitgravity Inc. Discussed with: alc, jeffr, and kib
* In swap pager, do not free the non-requested pages from the run if they arekib2010-04-291-3/+11
| | | | | | | | | wired. Kstack pages are wired, this change prepares swap pager for handling of long runs of kstack pages. Noted and reviewed by: alc Tested by: pho MFC after: 2 weeks
* Setting PG_REFERENCED on the requested page in swap_pager_getpages() isalc2010-04-171-5/+1
| | | | | | | | | | | either redundant or harmful, depending on the caller. For example, when called by vm_fault(), it is redundant. However, when called by vm_thread_swapin(), it is harmful. Specifically, if the thread is later swapped out, having PG_REFERENCED set on its stack pages leads the page daemon to reactivate these stack pages and delay their reclamation. Reviewed by: kib MFC after: 3 weeks
* Add sysctl documentation strings. The descriptions are derivedivoras2009-11-021-3/+7
| | | | | | | | | from tuning(7). One of the descriptions references tuning(7) because it is too complex to adequatly describe here (it is not a simple boolean sysctl) and users should be warned to that. Reviewed by: alc, kib Approved by: gnn (mentor)
* Remove spurious call to priv_check(PRIV_VM_SWAP_NOQUOTA).kib2009-10-181-6/+4
| | | | | | | | | | | | Call priv_check(PRIV_VM_SWAP_NORLIMIT) only when per-uid limit is actually exceed. Both changes aim at calling priv_check(9) only for the cases when privilege is actually exercised by the process. Reported and tested by: rwatson Reviewed by: alc MFC after: 3 days
* Initialize the uip to silence gcc warning that seems to sneak in in somekib2009-06-241-0/+1
| | | | | | build environments. Reported by: alc, bf1783 at googlemail com
OpenPOWER on IntegriCloud