unpin_user_p...e_dirty_lock(9)
π unpin_user_page_range_dirty_lock(9) β from the Kernel API Manual, section 9 π
okay so bestie, you know how you pinned a whole range of pages with one of the pin_user_pages girlies and now you gotta let them go? yeah. this is that function. it releases them, and if you want, it also marks them dirty on the way out. it's giving "cleanup era" β¨
β¨ NAME β¨
unpin_user_page_range_dirty_lock β release and optionally dirty gup-pinned page range π
like, you unpin a page range, and optionally you make it dirty. both things. one call. iconic.
πΈ SYNOPSIS πΈ
void unpin_user_page_range_dirty_lock (struct page *page , unsigned long
npages , bool make_dirty );
that's the whole signature, no cap. three args, one void, zero return values to worry about π«Ά
π¦ ARGUMENTS π¦
pageβ the starting page of a range that maybe gets marked dirty, and that definitely gets released. like, the release is not optional, bestie. that part is happening fr fr.npagesβ number of consecutive pages to release. count them. all of them. π’make_dirtyβ whether to mark the pages dirty. it's abool, so it's a yes-or-no vibe check π
π DESCRIPTION π
so when we say "gup-pinned page range", we mean a range of pages that has had one of the pin_user_pages variants called on that page. that's the whole definition. iykyk π₯
the contiguity rule is not a suggestion, okay? the page range must be truly physically contiguous: the page range corresponds to a contiguous PFN range and all pages can be iterated naturally. not "kinda contiguous". not "contiguous if you squint". truly. π¨
for the page ranges defined by [page .. page+npages], make that range (or its head pages, if a compound page) dirty, if make_dirty is true, and if the page range was previously listed as clean. two conditions, both gotta hit. π―
set_page_dirty_lock is used internally. and here's the tea β if instead, set_page_dirty is required, then the caller should:
- verify that this is really correct, because
_lockis usually required π (yes, actually check, don't just vibe your way through it), and - hand code it:
set_page_dirty_lock,unpin_user_page.
β οΈ real talk: that "is _lock usually required" bit is not me being dramatic, that's straight from the page. verify before you yeet the lock. π
π SEE ALSO π
all the siblings and cousins, from Kernel file ./mm/gup.c π§:
try_grab_folio(9)unpin_user_page(9)unpin_folio(9)folio_add_pin(9)unpin_user_pages_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)
and that's the page, bestie!! π this lil beauty lives in ./mm, dated October 2026, and it's brought to you by the Kernel API Manual (section 9, as always π). go forth, unpin responsibly, and remember β truly contiguous. mwah π
π¦ 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