swapin_sync(9)
π swapin_sync(9) β Kernel API Manual
okay bestie, welcome to swapin_sync(9) β¨ this one lives in the kernel API manual and it's literally the girl who pulls one swap entry β or a whole little squad of them β back in, and she does it without the readahead. no extras, no surprise guests, just the pages you actually asked for. π
π¦ SYNOPSIS
struct folio * swapin_sync (swp_entry_t entry , gfp_t gfp , unsigned long orders , struct vm_fault *vmf , struct mempolicy *mpol , pgoff_t ilx );
πΈ ARGUMENTS
entryβ the swap entry that points at the target slot. this is the thing you're saying "hey, bring this one back" about πgfpβ the memory allocation flags, aka the vibe check for how the allocation is allowed to behave.ordersβ the allocation orders. plural, babes, we can go big.vmfβ the fault information. the lore, if you will.mpolβ the NUMA memory allocation policy that gets applied.ilxβ the NUMA interleave index. β οΈ for use only whenMPOL_INTERLEAVEβ don't be out here using it any other time, iykyk.
β¨ DESCRIPTION
so here's the tea β: this allocates a folio that's suitable for the given orders, or it hands you back the existing folio that's already sitting in the swap cache for entry. whichever one applies, no cap.
it also kicks off the IO if that's needed β she's proactive like that, main character energy π₯
and one iconic detail: entry gets rounded down if orders allow a large allocation. the way that just happens for youβ¦ periodt. π
π CONTEXT
π¨ bestie listen to me: the caller must ensure entry is valid, and must pin the swap device with a refcount. non-negotiable, fr fr. do not skip this step. π
β RETURN
returns the folio on success β slay π β or an error code if it failed π.
π₯ SEE ALSO
kernel file ./mm/swap_state.c, plus the whole friend group:
swap_cache_get_folio(9)swap_cache_has_folio(9)swap_cache_get_shadow(9)__swap_cache_add_check(9)__swap_cache_add_folio(9)__swap_cache_del_folio(9)swap_cache_del_folio(9)__swap_cache_replace_folio(9)swap_cache_alloc_folio(9)swap_update_readahead(9)swap_cluster_readahead(9)swap_vma_readahead(9)swapin_readahead(9)
π«Ά and that's the whole page, bestie β brought to you from ./mm, dated October 2026. go forth and swap in sync, mwah ππ
π¦ 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