Lines Matching full:swap
42 * New Swap System
48 * to arbitrarily small or arbitrarily large swap spaces and an almost
53 * - on the fly reallocation of swap during putpages. The new system
54 * does not try to keep previously allocated swap blocks for dirty
57 * - on the fly deallocation of swap
59 * - No more garbage collection required. Unnecessarily allocated swap
62 * removal of invalidated swap blocks when a page is destroyed
138 * on-disk swap block (or SWAPBLK_NONE). The collection of these
155 static MALLOC_DEFINE(M_VMPGDATA, "vm_pgdata", "swap pager private data");
159 static int nswapdev; /* Number of swap devices */
161 static struct sx swdev_syscall_lock; /* serialize swap(on|off) */
167 static SYSCTL_NODE(_vm_stats, OID_AUTO, swap, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
168 "VM swap stats");
172 "Amount of swap storage needed to back all allocated anonymous memory.");
175 "Total amount of available swap storage.");
183 "Actual size of swap metadata zone");
186 "Maximum amount of swap supported");
191 "Number of pages that deferred freeing swap space");
315 printf("uid %d, pid %d: swap reservation " in swap_reserve_by_cred()
387 static int swap_pager_full = 2; /* swap space exhaustion (task killing) */
388 static int swap_pager_almost_full = 1; /* swap space exhaustion (w/hysteresis)*/
397 "Maximum running async swap ops");
401 "Swap Fragmentation Info");
422 * pagerops for OBJT_SWAP - "swap pager". Some ops are also global procedure
456 .pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */
470 "Maximum size of a swap block in pages");
482 * Swap bitmap functions
540 PCTRIE_DEFINE(SWAP, swblk, p, swblk_trie_alloc, swblk_trie_free);
633 * about to run out of swap space, using lowat/hiwat hysteresis.
646 printf("swap_pager: out of swap space\n"); in swp_sizecheck()
657 * SWAP_PAGER_INIT() - initialize the swap pager!
680 * defined MAX_PAGEOUT_CLUSTER. Also be aware that swap ops are in swap_pager_init()
681 * constrained by the swap device interleave stripe size. in swap_pager_init()
689 * SWAP_PAGER_SWAP_INIT() - swap pager initialization from pageout process
700 * Number of in-transit swap bp operations. Don't in swap_pager_swap_init()
707 * our pageout I/O. The value 4 works well for one or two active swap in swap_pager_swap_init()
710 * with three or four active swap devices since the system does not in swap_pager_swap_init()
712 * at least 2 per swap devices, and 4 is a pretty good value if you in swap_pager_swap_init()
713 * have one NFS swap device due to the command/ack latency over NFS. in swap_pager_swap_init()
756 printf("Swap blk zone entries changed from %lu to %lu.\n", in swap_pager_swap_init()
762 printf("Cannot reserve swap pctrie zone, " in swap_pager_swap_init()
849 * SWAP_PAGER_DEALLOC() - remove swap metadata from object
851 * The swap backing for the object is destroyed. The code is
882 * the swap meta data. We do not attempt to free swapblk's still in swap_pager_dealloc()
907 * SWAP PAGER BITMAP ROUTINES *
911 * SWP_PAGER_GETSWAPSPACE() - allocate raw swap space
913 * Allocate swap for up to the requested number of pages. The
914 * starting swap block number (a page index) is returned or
918 * when they configured swap and didn't configure enough.
1005 * SWP_PAGER_FREESWAPSPACE() - free raw swap space
1007 * This routine returns the specified swap blocks back to the bitmap.
1044 * SYSCTL_SWAP_FRAGMENTATION() - produce raw swap space stats
1074 * SWAP_PAGER_FREESPACE() - frees swap blocks associated with a page
1077 * This routine removes swapblk assignments from swap metadata.
1103 * SWAP_PAGER_RESERVE() - reserve swap blocks in object
1105 * Assigns swap blocks to the specified range within the object. The
1106 * swap blocks are not zeroed. Any previous swap assignment is destroyed.
1187 * Free left over swap blocks in source. in swap_pager_copy()
1287 * SWAP_PAGER_PAGE_UNSWAPPED() - remove swap backing store related to page
1289 * This removes any associated swap backing store, whether valid or
1293 * which point any associated swap can be freed. MADV_FREE also
1296 * NOTE!!! If the page is clean and the swap was valid, the caller
1347 * swap_pager_getpages() - bring pages in from swap
1379 ("page count %d extends beyond swap block", reqcount)); in swap_pager_getpages_locked()
1448 ("no swap blocking containing %p(%jx)", object, (uintmax_t)pindex)); in swap_pager_getpages_locked()
1517 * A final note: in a low swap situation, we cannot deallocate swap in swap_pager_getpages_locked()
1570 * Assign swap (if necessary) and initiate I/O on the specified pages.
1607 * Assign swap blocks and issue I/O. We reallocate swap on the fly. in swap_pager_putpages()
1612 /* Maximum I/O size is limited by maximum swap block size. */ in swap_pager_putpages()
1624 /* Get a block of swap of size up to size n. */ in swap_pager_putpages()
1725 * Completion routine for asynchronous reads and writes from/to swap.
1765 * cleanup pages. If an error occurs writing to swap, we are in in swp_pager_async_iodone()
1767 * we may be able to recover by reassigning the swap later on. So in swp_pager_async_iodone()
1770 * never reallocated as swap. Redirty the page and continue. in swp_pager_async_iodone()
1818 * swap in a low-swap situation. I don't think we'd in swp_pager_async_iodone()
1837 * A page is only written to swap after a period of in swp_pager_async_iodone()
1925 * to a swap device.
1975 * the swap block. in swap_pager_swapoff_object()
1989 /* Get the page from swap, and restart the scan. */ in swap_pager_swapoff_object()
1995 panic("%s: read from swap failed: %d", in swap_pager_swapoff_object()
2081 * unless we checked that our object is swap and not in swap_pager_swapoff()
2104 panic("swapoff: failed to locate %d swap blocks", in swap_pager_swapoff()
2114 * SWAP META DATA *
2117 * These routines manipulate the swap metadata stored in the
2120 * Swap metadata is implemented with a global hash and not directly
2157 * SWP_PAGER_META_BUILD() - add swap block to swap meta data for object
2159 * Try to add the specified swapblk to the object's swap metadata. If
2162 * replaces a valid swapblk, empty swap metadata is freed. If memory
2202 printf("swap blk zone exhausted, " in swp_pager_meta_build()
2234 printf("swap pctrie zone exhausted, " in swp_pager_meta_build()
2273 * swap metadata into dstobject.
2351 * SWP_PAGER_META_FREE() - free a range of blocks in the object's swap metadata
2353 * Return freed swap blocks to the swap bitmap, and free emptied swblk
2418 * SWP_PAGER_META_FREE_ALL() - destroy all swap metadata associated with object
2420 * This routine locates and destroys all swap metadata associated with
2437 * SWP_PAGER_METACTL() - misc control of swap meta data.
2440 * assignments in the swap meta data. It returns the swapblk being
2460 * pindex and for which there is a swap block allocated. Returns OBJ_MAX_SIZE
2461 * if are no allocated swap blocks for the object after the requested pindex.
2493 * Find the first index >= pindex that has either a valid page or a swap
2527 * Find the first index >= pindex that has neither a valid page nor a swap
2549 * Is every page in the backing object or swap shadowed in the parent, and
2550 * unbusy and valid in swap?
2674 * Swap metadata may not fit in the KVM if we have physical in sys_swapon()
2713 * Check that the total amount of swap currently configured does not
2723 printf("warning: total configured swap (%lu pages) " in swapon_check_swzone()
2727 "or reduce amount of swap.\n"); in swapon_check_swzone()
2872 * We can turn off this swap device safely only if the in swapoff_one()
2875 * the system doesn't become critically low on swap space. in swapoff_one()
2880 * On the other hand, not turning swap off on swapoff_all() in swapoff_one()
2881 * means that we can lose swap data when filesystems go away, in swapoff_one()
2937 printf("Cannot remove swap device %s (error=%d), " in swapoff_all()
2940 printf("Swap device %s removed.\n", devname); in swapoff_all()
3062 "Number of swap devices");
3065 "Swap statistics by device");
3068 * Count the approximate swap usage in pages for a vmspace. The
3069 * shadowed or not yet copied on write swap blocks are not accounted.
3123 .name = "SWAP",
3315 gp = g_new_geomf(&g_swap_class, "swap"); in swapongeom_locked()
3488 ("swap obj %p writecount %jx dec %jx", object, in swap_pager_release_writecount()