folio_mark_dirty(9)
β¨ folio_mark_dirty(9) β¨
okay so this is a page from the Kernel API Manual and bestie, it's a whole vibe. it's all about folio_mark_dirty and like... marking a folio as being modified π
like yes queen, you ARE dirty, own it.
πΈ NAME πΈ
folio_mark_dirty β Mark a folio as being modified.
π SYNOPSIS π
bool folio_mark_dirty (struct folio *folio );
π¦ ARGUMENTS π¦
folioβ The folio. that's it. that's the whole argument. the main character fr fr π
π DESCRIPTION π
okay so here's the tea, and it's actually important so listen up π«Ά
The folio may not be truncated while this function is running. nope. not allowed. not on your life.
Holding the folio lock is sufficient to prevent truncation β like, that's the easy slay way to do it β¨ β but some callers cannot acquire a sleeping lock π those poor things. These callers instead hold the page table lock for a page table which contains at least one page in this folio. and why does that work? because truncation will block on the page table lock as it unmaps pages before removing the folio from its mapping. iykyk π₯
DANGER: Do not use this on a folio obtained from a function likeget_user_pages_fastwithout holding appropriate locks β you might want to useset_page_dirty_lockorfolio_mark_dirty_lockinstead. seriously bestie, this is the "do not do the thing" part π don't be that girl.
β RETURN β
true if the folio was newly dirtied π β false if it was already dirty π (been there, done that, already filthy).
π SEE ALSO π
Kernel file ./mm/page-writeback.c and honestly the whole friend group:
node_dirtyable_memory(9)global_dirtyable_memory(9)domain_dirty_limits(9)global_dirty_limits(9)node_dirty_limit(9)node_dirty_ok(9)__wb_calc_thresh(9)balance_dirty_pages_ratelimited_flags(9)balance_dirty_pages_ratelimited(9)wb_over_bg_thresh(9)tag_pages_for_writeback(9)writeback_iter(9)filemap_dirty_folio(9)folio_redirty_for_writepage(9)folio_wait_writeback(9)folio_wait_writeback_killable(9)folio_wait_stable(9)
go read them, they ate π
<div style="text-align:center">πΈ π¦ π π¦ πΈ</div>
k that's the whole page bestie, mwah π this came out of ./mm and it's dated October 2026, so like, future-core of it all β slay, periodt β¨
π¦ 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