folio_add_pins(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– folio_add_pins(9) β€” Kernel API Manual, bestie edition πŸ’–

Okay so you found yourself in the kernel API manual, section 9, and the star of the show is folio_add_pins. Buckle up, this one's short but it's lowkey important. 🫢


✨ NAME ✨

folio_add_pins β€” literally just: add pins to an already-pinned folio. That's the whole vibe. No cap.


🌸 SYNOPSIS 🌸

int folio_add_pins (struct folio *folio , unsigned int pins );

Look at that signature. Clean. Iconic. Two arguments, one int return. She's giving "small function, big responsibilities". πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • folio β€” the folio you want to add more pins to. Your main character, your chosen one. πŸ‘‘
  • pins β€” the number of pins you're adding. Yes, you have to say how many. It's not a "just add one" situation, ok?

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea β˜•: this function tries to add more pins to a folio that is already pinned. Note the "try" β€” it's an attempt, not a guarantee, bestie.

And listen, the semantics of the pin (think FOLL_WRITE) β€” those follow whatever the existing pin is doing. You cannot change them. It's not that kind of party. πŸ™…β€β™€οΈ The existing pin is the blueprint, and this function is just following it.

When is this even useful? Great question, glad you asked. πŸ’– Picture this: you already grabbed a pin on a large folio using memfd_pin_folios, but later you want to logically unpin parts of it β€” like individual pages, for example β€” using unpin_user_page_range_dirty_lock. That's the moment this function shines. It's the setup that lets you tear things down piece by piece later. Chef's kiss. 🀌

🚨 Important vibe check: this is NOT the right interface to initially pin a folio. Do not come here first. This is a second-date function, not a first-date function. Use it to add pins to a folio that already has them, periodt. πŸ’€

🌈 SEE ALSO 🌈

The whole friend group, honestly. Go say hi:

Kernel file ./mm/gup.c and then a truly iconic lineup:

Fr fr, that's a whole group chat right there. πŸ’œ


Mwah πŸ’‹ β€” this page lives in ./mm, and the version stamp says October 2026. See you in the kernel, bestie! 🧚✨

πŸ“¦ where this page comes from