Lines Matching full:pages

109     /// Freed pages on the swap file are managed in a free list. `first_freed_idx_file` points to
137 /// This reuses freed file pages first. If the free list is empty, this allocates new pages in
141 // TODO(kawasin): Collect consecutive freed pages in the free list to reduce number of in allocate()
145 unreachable!("pages in free list must be freed pages") in allocate()
155 // The free list is empty. Allocate new pages. in allocate()
165 /// Find the index range of file pages that are all present.
170 /// Returns `None` if no pages after `idx_file` are present.
176 /// * `max_pages` - The maximum number of pages to search.
177 /// * `consecutive` - If true, the pages must have consecutive idx_page values.
198 let mut pages = 1; in find_present_pages_range() localVariable
209 || (consecutive && idx_page != head_idx_page + pages) in find_present_pages_range()
215 pages += 1; in find_present_pages_range()
216 if pages >= max_pages { in find_present_pages_range()
222 Some((idx_file..idx_file + pages, head_idx_page)) in find_present_pages_range()
271 /// [SwapFile] stores active pages in a memory region.
283 // All the data pages before this index are mlock(2)ed.
291 /// The all pages are marked as empty at first time.
296 /// * `num_of_pages` - The number of pages in the region.
324 /// * `idx_page` - the index of the page from the head of the pages.
349 /// This also `mlock2(2)` the pages not to be dropped again after populated. This does not block
357 /// This returns the number of consecutive pages which are newly mlock(2)ed. Returning `0` means
360 /// The caller must track the number of pages mlock(2)ed not to mlock(2) more pages than
365 /// * `max_pages` - The maximum number of pages to be mlock(2)ed at once.
373 let pages = idx_file_range.end - idx_file_range.start; in lock_and_async_prefetch() localVariable
375 let size_in_bytes = pages_to_bytes(pages); in lock_and_async_prefetch()
383 Ok(pages) in lock_and_async_prefetch()
390 /// Mark the pages in the file corresponding to the index as cleared.
395 /// If the pages are mlock(2)ed, unlock them before MADV_DONTNEED. This returns the number of
396 /// pages munlock(2)ed.
400 /// * `idx_page_range` - The indices of consecutive pages to be cleared. All the pages must be
413 let pages = idx_file_range.end.min(self.cursor_mlock) - idx_file_range.start; in clear_range() localVariable
414 // munlock(2) first because MADV_DONTNEED fails for mlock(2)ed pages. in clear_range()
416 .unlock(offset, pages_to_bytes(pages)) in clear_range()
418 pages in clear_range()
424 // The page cache is cleared without writing pages back to file even if they are dirty. in clear_range()
432 /// Free the pages corresponding to the given range in the file.
434 /// If the pages are mlock(2)ed, unlock them. This returns the number of pages munlock(2)ed.
438 /// * `idx_page_range` - The indices of consecutive pages to be freed. This may contains
439 /// non-present pages.
488 /// munlock(2) pages if there are mlock(2)ed pages in the mmap and reset the internal cursor for
493 // vmm-swap enable. munlock(2)ing the whole possible pages is not a problem because this in clear_mlock()
509 /// * `idx` - the index of the page from the head of the pages.
532 /// * `idx_page` - the index of the head page of the content from the head of the pages.
564 unreachable!("pages must be allocated"); in write_to_file()
573 // syscall is more explicit for kernel how many pages are going to be written while in write_to_file()
595 /// Returns the first range of indices of consecutive pages present in the swap file.
600 /// pages is longer than this.
618 /// Returns the [VolatileSlice] corresponding to the indices regardless of whether the pages are
625 /// * `idx_page_range` - the indices of the pages. All the pages must be present and consecutive
639 /// Returns the count of present pages in the swap file.
657 // Validate that the idx_range is for cosecutive present file pages. in convert_idx_page_range_to_idx_file()
856 let pages = swap_file.lock_and_async_prefetch(2).unwrap(); in lock_and_start_populate() localVariable
857 if pages == 0 { in lock_and_start_populate()
860 assert!(pages <= 2); in lock_and_start_populate()
861 locked_pages += pages; in lock_and_start_populate()
890 // locked pages only in clear_range_unlocked_pages()
892 // locked pages + non-locked pages in clear_range_unlocked_pages()
894 // non-locked pages in clear_range_unlocked_pages()
956 // empty pages in free_range_unlocked_pages()
958 // empty pages + locked pages in free_range_unlocked_pages()
960 // locked pages only in free_range_unlocked_pages()
962 // empty pages + locked pages + non-locked pages in free_range_unlocked_pages()
964 // non-locked pages in free_range_unlocked_pages()