pin_hibernation_swap_type(9)
π pin_hibernation_swap_type(9) π
okay so bestie, welcome to the Kernel API Manual β yes we're reading kernel docs together, this is our bonding era π«Ά. Today's main character is pin_hibernation_swap_type, and ngl, it's giving "tiny function, huge responsibility."
β¨ NAME β¨
pin_hibernation_swap_type β pin the swap device for hibernation ππ€
πΈ SYNOPSIS πΈ
int pin_hibernation_swap_type (dev_t device , sector_t offset );
π ARGUMENTS π
deviceβ the block device that's holding the resume image πoffsetβ the offset that identifies the swap area, a.k.a. the "which swap area tho" coordinate π
π¦ DESCRIPTION π¦
So here's the vibe: it goes and locates the swap device that matches device/offset, then marks it as pinned for hibernation. While it's pinned, swapoff is prevented β like, absolutely not, we're not doing that right now π
.
And listen, bestie, there's a limit here: only one uswsusp context may pin a swap device at a time. That's the rule. If it's already pinned, this function just returns -EBUSY and moves on. No drama, just a hard no π.
π₯ RETURN π₯
>= 0β success, and you get the swap type back β¨-EINVALβdeviceis invalid, like girl what even is that π-ENODEVβ the swap device was not found, it's literally not here π-EBUSYβ the device is already pinned for hibernation, someone else got here first π
π SEE ALSO π
Kernel file ./mm/swapfile.c β and the whole friend group:
swap_put_entries_cluster(9), swap_dup_entries_cluster(9), folio_alloc_swap(9), folio_dup_swap(9), folio_put_swap(9), swap_entry_swapped(9), folio_free_swap(9), swap_put_entries_direct(9), swap_alloc_hibernation_slot(9), swap_free_hibernation_slot(9), unpin_hibernation_swap_type(9), find_hibernation_swap_type(9)
π friendly reminder: pinning is a commitment. Only one uswsusp context at a time, iykyk.
and that's the whole page, bestie, you ate πβ¨ β this iconic little number lives in ./mm, dated October 2026, and it's filed under pin_hibernation_swap_type(9). 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