diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -326,6 +326,7 @@ /* Freed lock blocks both shared and exclusive. */ #define VPB_FREED (0xffffffff - VPB_BIT_SHARED) +/* Page queues -- Documented by vm_page_queue(9). */ #define PQ_NONE 255 #define PQ_INACTIVE 0 #define PQ_ACTIVE 1 @@ -724,11 +725,17 @@ ("vm_page_assert_busied: page %p not busy @ %s:%d", \ (m), __FILE__, __LINE__)) +/* + * vm_page_assert_sbusied(9) + */ #define vm_page_assert_sbusied(m) \ KASSERT(vm_page_sbusied(m), \ ("vm_page_assert_sbusied: page %p not shared busy @ %s:%d", \ (m), __FILE__, __LINE__)) +/* + * vm_page_assert_unbusied(9) + */ #define vm_page_assert_unbusied(m) \ KASSERT((vm_page_busy_fetch(m) & ~VPB_BIT_WAITERS) != \ VPB_CURTHREAD_EXCLUSIVE, \ @@ -741,6 +748,10 @@ ("vm_page_assert_xbusied: page %p not exclusive busy @ %s:%d", \ (m), __FILE__, __LINE__)); \ } while (0) + +/* + * vm_page_assert_xbusied(9) + */ #define vm_page_assert_xbusied(m) do { \ vm_page_assert_xbusied_unchecked(m); \ KASSERT((vm_page_busy_fetch(m) & ~VPB_BIT_WAITERS) == \ @@ -750,16 +761,26 @@ (m), (m)->busy_lock, __FILE__, __LINE__)); \ } while (0) +/* + * vm_page_busied(9) + */ #define vm_page_busied(m) \ (vm_page_busy_fetch(m) != VPB_UNBUSIED) +/* + * vm_page_xbusied(9) + */ #define vm_page_xbusied(m) \ ((vm_page_busy_fetch(m) & VPB_SINGLE_EXCLUSIVE) != 0) #define vm_page_busy_freed(m) \ (vm_page_busy_fetch(m) == VPB_FREED) -/* Note: page m's lock must not be owned by the caller. */ +/* + * vm_page_xunbusy(9): + * + * Note: page m's lock must not be owned by the caller. + */ #define vm_page_xunbusy(m) do { \ if (!atomic_cmpset_rel_int(&(m)->busy_lock, \ VPB_CURTHREAD_EXCLUSIVE, VPB_UNBUSIED)) \ @@ -833,6 +854,8 @@ } /* + * vm_page_aflag_clear(9): + * * Clear the given bits in the specified page. */ static inline void @@ -851,6 +874,8 @@ } /* + * vm_page_aflag_set(9): + * * Set the given bits in the specified page. */ static inline void @@ -871,7 +896,7 @@ } /* - * vm_page_dirty: + * vm_page_dirty(9): * * Set all bits in the page's dirty field. * @@ -893,7 +918,7 @@ } /* - * vm_page_undirty: + * vm_page_undirty(9): * * Set page to not be dirty. Note: does not clear pmap modify bits */ @@ -915,7 +940,7 @@ } /* - * vm_page_queue: + * vm_page_queue(9): * * Return the index of the queue containing m. */ @@ -926,6 +951,9 @@ return (_vm_page_queue(vm_page_astate_load(m))); } +/* + * vm_page_active(9) + */ static inline bool vm_page_active(vm_page_t m) { @@ -933,6 +961,9 @@ return (vm_page_queue(m) == PQ_ACTIVE); } +/* + * vm_page_inactive(9) + */ static inline bool vm_page_inactive(vm_page_t m) { @@ -940,6 +971,9 @@ return (vm_page_queue(m) == PQ_INACTIVE); } +/* + * vm_page_in_laundry(9) + */ static inline bool vm_page_in_laundry(vm_page_t m) { diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -247,7 +247,7 @@ #endif /* - * vm_set_page_size: + * vm_set_page_size(9): * * Sets the page size, perhaps based upon the memory * size. Must be called before any use of page-size @@ -819,6 +819,9 @@ return (vaddr); } +/* + * vm_page_reference(9) + */ void vm_page_reference(vm_page_t m) { @@ -903,7 +906,7 @@ } /* - * vm_page_busy_downgrade: + * vm_page_busy_downgrade(9): * * Downgrade an exclusive busy page into a single shared busy page. */ @@ -952,7 +955,7 @@ } /* - * vm_page_sbusied: + * vm_page_sbusied(9): * * Return a positive value if the page is shared busied, 0 otherwise. */ @@ -966,7 +969,7 @@ } /* - * vm_page_sunbusy: + * vm_page_sunbusy(9): * * Shared unbusy a page. */ @@ -999,7 +1002,7 @@ } /* - * vm_page_busy_sleep: + * vm_page_busy_sleep(9): * * Sleep if the page is busy, using the page pointer as wchan. * This is used to implement the hard-path of the busying mechanism. @@ -1105,7 +1108,7 @@ } /* - * vm_page_trysbusy: + * vm_page_trysbusy(9): * * Try to shared busy a page. * If the operation succeeds 1 is returned otherwise 0. @@ -1143,7 +1146,7 @@ } /* - * vm_page_tryxbusy: + * vm_page_tryxbusy(9): * * Try to exclusive busy a page. * If the operation succeeds 1 is returned otherwise 0. @@ -1320,7 +1323,7 @@ } /* - * vm_page_free: + * vm_page_free(9): * * Free a page. */ @@ -1333,7 +1336,7 @@ } /* - * vm_page_free_zero: + * vm_page_free_zero(9): * * Free a page to the zerod-pages queue */ @@ -1421,7 +1424,7 @@ } /* - * vm_page_insert: [ internal use only ] + * vm_page_insert(9): [ internal use only ] * * Inserts the given mem entry into the object and object list. * @@ -1584,7 +1587,7 @@ } /* - * vm_page_remove: + * vm_page_remove(9): * * Removes the specified page from its containing object, but does not * invalidate any backing storage. Returns true if the object's reference @@ -1621,7 +1624,7 @@ } /* - * vm_page_lookup: + * vm_page_lookup(9): * * Returns the page associated with the object/offset * pair specified; if none is found, NULL is returned. @@ -1829,7 +1832,7 @@ } /* - * vm_page_rename: + * vm_page_rename(9): * * Move the given memory entry from its * current object to the specified target object/offset. @@ -1889,7 +1892,7 @@ } /* - * vm_page_alloc: + * vm_page_alloc(9): * * Allocate and return a page that is associated with the specified * object and offset pair. By default, this page is exclusive busied. @@ -1928,6 +1931,8 @@ } /* + * vm_page_alloc_after(9): + * * Allocate a page in the specified object with the given page index. To * optimize insertion of the page into the object, the caller must also specifiy * the resident page in the object with largest index smaller than the given @@ -2130,7 +2135,7 @@ } /* - * vm_page_alloc_contig: + * vm_page_alloc_contig(9): * * Allocate a contiguous set of physical pages of the given size "npages" * from the free lists. All of the physical pages must be at or above @@ -2224,6 +2229,9 @@ return (NULL); } +/* + * vm_page_alloc_contig_domain(9) + */ vm_page_t vm_page_alloc_contig_domain(vm_object_t object, vm_pindex_t pindex, int domain, int req, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, @@ -2406,6 +2414,9 @@ return (m); } +/* + * vm_page_alloc_freelist(9) + */ vm_page_t vm_page_alloc_freelist(int freelist, int req) { @@ -2423,6 +2434,9 @@ return (m); } +/* + * vm_page_alloc_freelist_domain(9) + */ vm_page_t vm_page_alloc_freelist_domain(int domain, int freelist, int req) { @@ -2432,6 +2446,9 @@ return (_vm_page_alloc_noobj_domain(domain, freelist, req)); } +/* + * vm_page_alloc_noobj(9) + */ vm_page_t vm_page_alloc_noobj(int req) { @@ -2449,12 +2466,18 @@ return (m); } +/* + * vm_page_alloc_noobj_domain(9) + */ vm_page_t vm_page_alloc_noobj_domain(int domain, int req) { return (_vm_page_alloc_noobj_domain(domain, VM_NFREELIST, req)); } +/* + * vm_page_alloc_noobj_contig(9) + */ vm_page_t vm_page_alloc_noobj_contig(int req, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, @@ -2475,6 +2498,9 @@ return (m); } +/* + * vm_page_alloc_noobj_contig_domain(9) + */ vm_page_t vm_page_alloc_noobj_contig_domain(int domain, int req, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, @@ -3957,7 +3983,7 @@ } /* - * vm_page_free_toq: + * vm_page_free_toq(9): * * Returns the given page to the free list, disassociating it * from any VM object. @@ -4014,6 +4040,8 @@ } /* + * vm_page_wire(9): + * * Mark this page as wired down. For managed pages, this prevents reclamation * by the page daemon, or when the containing object, if any, is destroyed. */ @@ -4042,6 +4070,8 @@ } /* + * vm_page_wire_mapped(9): + * * Attempt to wire a mapped page following a pmap lookup of that page. * This may fail if a thread is concurrently tearing down mappings of the page. * The transient failure is acceptable because it translates to the @@ -4123,6 +4153,8 @@ } /* + * vm_page_unwire(9): + * * Release one wiring of the specified page, potentially allowing it to be * paged out. * @@ -4148,6 +4180,8 @@ } /* + * vm_page_unwire_noq(9): + * * Unwire a page without (re-)inserting it into a page queue. It is up * to the caller to enqueue, requeue, or free the page as appropriate. * In most cases involving managed pages, vm_page_unwire() should be used @@ -4214,6 +4248,8 @@ } /* + * vm_page_activate(9): + * * Put the specified page on the active list (if appropriate). */ void @@ -4224,6 +4260,8 @@ } /* + * vm_page_deactivate(9): + * * Move the specified page to the tail of the inactive queue, or requeue * the page if it is already in the inactive queue. */ @@ -4234,6 +4272,12 @@ vm_page_mvqueue(m, PQ_INACTIVE, PGA_REQUEUE); } +/* + * vm_page_deactivate_noreuse(9): + * + * Move the specified page to the *head* of the inactive queue, or requeue + * the page if it is already in the inactive queue. + */ void vm_page_deactivate_noreuse(vm_page_t m) { @@ -4242,6 +4286,8 @@ } /* + * vm_page_launder(9): + * * Put a page in the laundry, or requeue it if it is already there. */ void @@ -4252,6 +4298,8 @@ } /* + * vm_page_unswappable(9): + * * Put a page in the PQ_UNSWAPPABLE holding queue. */ void @@ -4425,7 +4473,7 @@ } /* - * vm_page_advise + * vm_page_advise(9): * * Apply the specified advice to the given page. */ @@ -4563,6 +4611,8 @@ } /* + * vm_page_grab(9): + * * Grab a page, waiting until we are waken up due to the page * changing state. We keep on waiting, if the page continues * to be in the object. If the page doesn't exist, first allocate it @@ -4994,6 +5044,8 @@ } /* + * vm_page_bits(9): + * * Mapping function for valid or dirty bits in a page. * * Inputs are required to range within a page. @@ -5243,7 +5295,7 @@ } /* - * vm_page_set_validclean: + * vm_page_set_validclean(9): * * Sets portions of a page valid and clean. The arguments are expected * to be DEV_BSIZE aligned but if they aren't the bitmap is inclusive @@ -5333,6 +5385,9 @@ vm_page_clear_dirty_mask(m, pagebits); } +/* + * vm_page_clear_dirty(9) + */ void vm_page_clear_dirty(vm_page_t m, int base, int size) { @@ -5341,7 +5396,7 @@ } /* - * vm_page_set_invalid: + * vm_page_set_invalid(9): * * Invalidates DEV_BSIZE'd chunks within a page. Both the * valid and dirty bits for the effected areas are cleared. @@ -5402,7 +5457,7 @@ } /* - * vm_page_zero_invalid() + * vm_page_zero_invalid(9): * * The kernel assumes that the invalid portions of a page contain * garbage, but such pages can be mapped into memory by user code. @@ -5445,7 +5500,7 @@ } /* - * vm_page_is_valid: + * vm_page_is_valid(9): * * Is (partial) page valid? Note that the case where size == 0 * will return FALSE in the degenerate case where the page is @@ -5511,6 +5566,8 @@ } /* + * vm_page_test_dirty(9): + * * Set the page's dirty bits if the page is modified. */ void