mm_account_fault(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… mm_account_fault(9) β€” like, the page fault accounting girlies πŸ’…

okay so this is a page from the Kernel API Manual, bestie β€” it's mm_account_fault(9) and it's genuinely the moment where the kernel sits down and does its page fault bookkeeping. pull up a chair πŸŽ€


✨ NAME ✨

mm_account_fault β€” do page fault accounting πŸ’– (yes that's the whole vibe, it literally just tallies up faults)


πŸ¦‹ SYNOPSIS πŸ¦‹

void mm_account_fault (struct mm_struct *mm , struct pt_regs *regs ,
unsigned long address , unsigned int flags , vm_fault_t ret );

it returns void, so no return value drama β€” it just does the thing and dips ✌️


🌸 ARGUMENTS 🌸

  • mm β€” the mm we're pulling the memcg out of. it can be NULL, no cap, that's allowed 🫢
  • regs β€” the pt_regs struct pointer. when it's set to NULL we skip the accounting of perf event counters β€” but we still do the per-task accounting to the task that triggered this page fault. so like, don't think you're getting out of it entirely 😭
  • address β€” the faulted address. the address that faulted. the one and only πŸ“
  • flags β€” the fault flags 🚩
  • ret β€” the fault retcode ⭐

πŸ‘‘ DESCRIPTION πŸ‘‘

okay so the way that this is doing the most β€” it takes care of most of the page fault accounting. iconic. and it also includes the PERF_COUNT_SW_PAGE_FAULTS_[MAJ|MIN] perf counter updates πŸ”₯

but listen, bestie β€” the handling of PERF_COUNT_SW_PAGE_FAULTS should still be in per-arch page fault handlers at the entry of page fault. that one's not on this function, mmkay? don't come for her πŸ’…

🧚 SEE ALSO 🧚

Kernel file ./mm/memory.c β€” and like, the whole extended friend group:


and that's the whole page, bestie β€” go account some faults responsibly πŸ’œ

this cutie came out of ./mm and it's dated October 2026, iykyk πŸŽ€βœ¨

πŸ“¦ where this page comes from