folio_mark_dirty(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 like get_user_pages_fast without holding appropriate locks β€” you might want to use set_page_dirty_lock or folio_mark_dirty_lock instead. 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:

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