folio_referenced(9)
πΈ folio_referenced(9) β the kernel API manual, bestie edition πΈ
okay so this is folio_referenced(9) from the Kernel API Manual, and it's honestly such a little icon. it answers one very specific question: was this folio, like, touched? π let's get into it.
β¨ NAME β¨
folio_referenced β test if the folio was referenced. that's it. that's the whole vibe check. π«Ά
π SYNOPSIS π
int folio_referenced (struct folio *folio , int is_locked , struct
mem_cgroup *memcg , vma_flags_t *vma_flags );
π ARGUMENTS π
folioβ the folio you're testing, bestie. the main character of this whole operation. πis_lockedβ says whether the caller holds the lock on the folio. caller-held lock energy.memcgβ the target memory cgroup.vma_flagsβ a combination of all thevma->flagswhich referenced the folio. like a little receipt of who came by π
π¦ DESCRIPTION π¦
quick test_and_clear_referenced for all mappings of a folio. lowkey a speedy little check across every mapping, ngl. β
π§ RETURN π§
it gives you back the number of mappings which referenced the folio. π₯
but heads up: it returns -1 if the function bailed out due to rmap lock contention π β that's contention, not "no refs", so don't get it twisted.
π SEE ALSO π
so many siblings, fr fr. all of these live in the kernel file ./mm/rmap.c:
__anon_vma_prepare(9)anon_vma_clone(9)unlink_anon_vmas(9)page_address_in_vma(9)mapping_wrprotect_range(9)pfn_mkclean_range(9)folio_move_anon_rmap(9)__folio_set_anon(9)__page_check_anon_rmap(9)folio_add_anon_rmap_ptes(9)folio_add_anon_rmap_pmd(9)folio_add_new_anon_rmap(9)folio_add_file_rmap_ptes(9)folio_add_file_rmap_pmd(9)folio_add_file_rmap_pud(9)folio_remove_rmap_ptes(9)folio_remove_rmap_pmd(9)folio_remove_rmap_pud(9)try_to_unmap(9)try_to_migrate(9)make_device_exclusive(9)__rmap_walk_file(9)
anyway that's the whole page, no notes π this one came to you from ./mm, dated October 2026 β mwah, go check your folios, ily, bye!! πβ¨
π¦ 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