_shift_data_left_pages(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 _shift_data_left_pages β€” a Kernel API Manual moment 🌸

okay bestie, so this is a page from the Kernel API Manual (that's the (9) bit, section 9, kernel developer vibes πŸ’…). It's called _shift_data_left_pages and honestly? It's giving "small but mighty helper function" energy. Let's get into it 🫢


✨ NAME ✨

_shift_data_left_pages β€”

so like… the original page literally leaves this blank after the dash 😭 no cap, there's no description here. We move on. Main character energy is elsewhere, iykyk.


πŸ¦‹ SYNOPSIS πŸ¦‹

void _shift_data_left_pages (struct page **pages , size_t pgto_base ,
size_t pgfrom_base , size_t len );

that's the whole vibe: returns void, so it's not gonna hand you anything back. It just does the thing πŸ’«


πŸ’– ARGUMENTS πŸ’–

  • pages β€” the vector of pages holding both the source and the dest memory area. like, one big friend group of pages, both sides living in it πŸ’€
  • pgto_base β€” the page vector address of the destination (where the data is heading πŸƒβ€β™€οΈ)
  • pgfrom_base β€” the page vector address of the source (where the data's coming from ✨)
  • len β€” the number of bytes to copy, bestie. count 'em. πŸ“

πŸŽ€ NOTE πŸŽ€

okay this part matters, so listen up πŸ‘‘

the addresses pgto_base and pgfrom_base are both calculated in the same way: if a memory area starts at byte base in page pages[i], then its address is given as:

(i << PAGE_CACHE_SHIFT) + base

also note (and this is the important bit, ngl): pgto_base must be < pgfrom_base β€” like, that's a hard requirement, not a suggestion πŸ”₯ but the memory areas they point to may overlap. so the addresses are ordered, the actual memory doesn't have to be. iconic, honestly.

🚨 read that again, bestie: pgto_base must be less than pgfrom_base. don't come crying to me if you flip them πŸ’€

🌈 SEE ALSO 🌈

this is a whole friend group, fr fr β€” all from the kernel file ./net/sunrpc/xdr.c:

like, that's a lot of siblings. go say hi to _shift_data_right_pages(9) especially, it's literally the mirror twin πŸͺž


and that's the whole page, bestie πŸŽ€ sign-off time: this one lives in ./net/sunrpc, dated October 2026, and it's filed under _shift_data_left_pages(9). slay, go shift some data. leftwards. πŸ’œβœ¨

πŸ“¦ where this page comes from