scribble_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– scribble_alloc(9) β€” a Kernel API Manual moment πŸ’–

okay so bestie, this one's from the kernel API manual (section 9, the fancy "kernel internals" section, iykyk) and it's called scribble_alloc. yes, scribble. like the scratch paper of the kernel. we love an underrated icon πŸŽ€


✨ NAME ✨

scribble_alloc β€” allocate percpu scribble buffer for required size of the scribble region

like, it goes and gets you the scratch space. for one cpu's worth. that's the whole vibe πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

int scribble_alloc (struct raid5_percpu *percpu , int num , int cnt );

returns an int, takes three args. no cap, that's it 🫢


🌸 ARGUMENTS 🌸

  • percpu β€” from for_each_present_cpu of the caller. so whoever's calling this is looping over the present cpus and hands you the one they're on rn πŸ’œ
  • num β€” total number of disks in the array. the whole squad, not just the data ones ⭐
  • cnt β€” scribble objs count for required size of the scribble region. literally the count of scribble objects that decides how big the region needs to be πŸ“

πŸ”₯ DESCRIPTION πŸ”₯

okay so the whole point: the scribble buffer size must be enough to contain two things, and the manpage numbers them, so we're numbering them:

  1. a struct page pointer for each device in the array +2
  2. room to convert each entry in (1) to its corresponding dma (dma_map_page) or page (page_address) address

that's the requirement. that's the assignment. main character energy honestly 🌈


πŸ‘‘ NOTE πŸ‘‘

and before you ask about the +2 β€” the +2 is for the destination buffers of the ddf/raid6 case where we calculate over all devices (not just the data blocks), using zeros in place of the P and Q blocks. so it's not a random +2, it's a very deliberate +2, respect it πŸ™ˆ


πŸ’€ SEE ALSO πŸ’€

Kernel file ./drivers/md/raid5.c

like, go read the actual source if you want the lore. it's all in there, fr fr 🧚


so that's the page, bestie πŸ’– this little gem lives in ./drivers/md and it's dated October 2026, and yeah, the whole thing is signed scribble_alloc(9) β€” go forth and allocate your scribbles responsibly, mwah πŸ’…βœ¨

πŸ“¦ where this page comes from