unpin_user_pages_dirty_lock(9)
π 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 thepagesarray. just a count, she's doing her job πmake_dirtyβ whether to mark the pages dirty. abool, 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:
- a) verify that this is really correct, because
_lockis usually required β like fr fr, do not skip this, this is the "are you SURE" step π - 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:
try_grab_folio(9)unpin_user_page(9)unpin_folio(9)folio_add_pin(9)unpin_user_page_range_dirty_lock(9)unpin_user_pages(9)unpin_user_folio(9)unpin_folios(9)try_grab_folio_fast(9)follow_page_mask(9)__get_user_pages(9)fixup_user_fault(9)populate_vma_page_range(9)fault_in_writeable(9)fault_in_subpage_writeable(9)fault_in_readable(9)get_dump_page(9)get_user_pages_remote(9)get_user_pages(9)get_user_pages_fast_only(9)get_user_pages_fast(9)pin_user_pages_fast(9)pin_user_pages_remote(9)pin_user_pages(9)memfd_pin_folios(9)folio_add_pins(9)
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
- 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