unpin_user_pages_dirty_lock(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… unpin_user_pages_dirty_lock(9) β€” like, the whole Kernel API Manual moment

okay bestie, so this is a page from the Kernel API Manual, and it's about unpin_user_pages_dirty_lock(9), which is genuinely the "let go of my hand and also maybe smudge it" of kernel functions. buckle up πŸŽ€


✨ NAME ✨

unpin_user_pages_dirty_lock β€” release and optionally dirty gup-pinned pages 🫢


🌸 SYNOPSIS 🌸

void unpin_user_pages_dirty_lock (struct page **pages , unsigned long
npages , bool make_dirty );

that's it, that's the whole vibe check πŸ’–


πŸ¦‹ ARGUMENTS πŸ¦‹

  • pages β€” array of pages to be maybe marked dirty, and definitely released. like, the "we are SO done here" list, no cap.
  • npages β€” number of pages in the pages array. just a count, she's doing her job πŸ™ˆ
  • make_dirty β€” whether to mark the pages dirty. a bool, so it's giving yes/no, on/off, iconic/also iconic πŸ’…

πŸ”₯ DESCRIPTION πŸ”₯

a "gup-pinned page" refers to a page that has had one of the get_user_pages variants called on that page. that's the whole definition, periodt.

so here's the tea: for each page in the pages array, make that page (or its head page, if a compound page) dirty β€” but only if make_dirty is true, and only if the page was previously listed as clean. conditional queen πŸ‘‘

in any case, releases all pages using unpin_user_page, possibly via unpin_user_pages, for the non-dirty case. either way they get freed, bestie, no page left behind πŸ’€

please see the unpin_user_page documentation for details. (iykyk β€” go read it, it's right there)

set_page_dirty_lock is used internally. and if instead set_page_dirty is required, then the caller should:

  1. a) verify that this is really correct, because _lock is usually required β€” like fr fr, do not skip this, this is the "are you SURE" step 😭
  2. b) hand code it:
set_page_dirty_lock, unpin_user_page

that's literally the line, I'm not even joking, that's what it says 🫑


🌈 SEE ALSO 🌈

Kernel file ./mm/gup.c β€” and honestly the whole friend group showed up:

like, twenty-six entries, she brought the entire group chat πŸ§šπŸ’œ


okay that's the page!! this iconic lil doc lives in ./mm, dated October 2026, and it answers to the name unpin_user_pages_dirty_lock(9) β€” go forth and unpin responsibly, bestie πŸŒΈβœ¨πŸŽ€

πŸ“¦ where this page comes from