sg_set_page(9)
β¨ sg_set_page(9) β¨
okay so this is from the Kernel API Manual, and bestie, it's a whole little scatterlist moment. it's giving "small function, big rules." let's get into it π
π NAME π
sg_set_page β set an sg entry so it points at a given page. that's it, that's the vibe π¦
πΈ SYNOPSIS πΈ
void sg_set_page (struct scatterlist *sg , struct page *page , unsigned
int len , unsigned int offset );
literally just one call, four things in, nothing out. void, so don't go looking for a return value, she doesn't have one π
π«Ά ARGUMENTS π«Ά
sgβ the SG entry. like, the actual scatterlist slot you're messing with β¨pageβ the page. the one and only πlenβ how much data. the length, the amount, the whole point πoffsetβ offset into the page. where inside that page you're starting, iykyk π
π₯ DESCRIPTION π₯
use this function to set an sg entry pointing at a page. that's the whole assignment job, and it's hers π
β οΈ never assign the page directly. like, do not just go poking the page field yourself. no cap, don't do it. we encode sg table information in the lower bits of the page pointer π so a raw assignment would stomp all over that and ruin everything.
if you're trying to go the other direction β you got an sg entry and you wanna know which page belongs to it β see sg_page. she's the lookup queen π
π SEE ALSO π
kernel file ./tools/virtio/linux/scatterlist.h, plus the whole scatterlist friend group:
and that's the page, bestie π§ source/version lives at ./tools/virtio/linux, dated October 2026, and yes she's still sg_set_page(9) at the bottom, iconic to the very last line ππ
π¦ 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