swap_pte_batch(9)
π swap_pte_batch(9) β kernel API manual, but make it make sense
okay bestie, so this is swap_pte_batch, a page straight outta the Kernel API Manual (section 9, kernel land, we love her) β and she's here to help you figure out how many swap entries in a row can be batched together. lowkey iconic behavior tbh β¨
π NAME
swap_pte_batch β detect a PTE batch for a set of contiguous swap entries π«
πΈ SYNOPSIS
int swap_pte_batch (pte_t *start_ptep , int max_nr , pte_t pte );
π¦ ARGUMENTS
start_ptepβ Page table pointer for the first entry. like, where the party starts π«Άmax_nrβ The maximum number of table entries to consider. it's giving "how many invites we printed" πpteβ Page table entry for the first entry. the main character, the blueprint, the reference point π
β¨ DESCRIPTION
okay so the whole vibe: this function detects a batch of contiguous swap entries β meaning consecutive (non-present) PTEs that contain swap entries, where the swap entries all have consecutive offsets, all target the same swap type, and all have matching swp pte bits. fr fr, they have to match on everything to count as a batch π
π¨ bestie, heads up: max_nr must be at least one, and must be limited by the caller so that scanning cannot exceed a single page table. no overachieving, no crossing boundaries, we stay in our lane π
π₯ RETURN
the number of table entries in the batch. that's it, that's the answer, periodt β¨
π SEE ALSO
Kernel file ./mm/internal.h, plus all these besties:
folio_pte_batch_flags(9)pte_move_swp_offset(9)pte_next_swp_offset(9)sync_with_folio_pmd_zap(9)folio_evictable(9)vma_filebacked_address(9)vma_anon_address(9)
go read them, iykwim π§
okay that's the whole page, no cap π β this one lives in ./mm (source/version) and it's dated October 2026, and the page itself is swap_pte_batch(9). mwah, study hard, slay πππΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms