/* * Return the count of contiguous swap entries that share the same * zeromap status as the starting entry. If is_zeromap is not NULL, * it will return the zeromap status of the starting entry.
*/ staticinlineint swap_zeromap_batch(swp_entry_t entry, int max_nr, bool *is_zeromap)
{ struct swap_info_struct *sis = swp_swap_info(entry); unsignedlong start = swp_offset(entry); unsignedlong end = start + max_nr; bool first_bit;
first_bit = test_bit(start, sis->zeromap); if (is_zeromap)
*is_zeromap = first_bit;
staticinlineint non_swapcache_batch(swp_entry_t entry, int max_nr)
{ struct swap_info_struct *si = swp_swap_info(entry);
pgoff_t offset = swp_offset(entry); int i;
/* * While allocating a large folio and doing mTHP swapin, we need to * ensure all entries are not cached, otherwise, the mTHP folio will * be in conflict with the folio in swap cache.
*/ for (i = 0; i < max_nr; i++) { if ((si->swap_map[offset + i] & SWAP_HAS_CACHE)) return i;
}
/** * folio_index - File index of a folio. * @folio: The folio. * * For a folio which is either in the page cache or the swap cache, * return its index within the address_space it belongs to. If you know * the folio is definitely in the page cache, you can look at the folio's * index directly. * * Return: The index (offset in units of pages) of a folio in its file.
*/ staticinline pgoff_t folio_index(struct folio *folio)
{ if (unlikely(folio_test_swapcache(folio))) return swap_cache_index(folio->swap); return folio->index;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.