include/linux/mmu_notifier.h
Source file repositories/reference/linux-study-clean/include/linux/mmu_notifier.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/mmu_notifier.h- Extension
.h- Size
- 22746 bytes
- Lines
- 649
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/list.hlinux/spinlock.hlinux/mm_types.hlinux/mmap_lock.hlinux/srcu.hlinux/interval_tree.h
Detected Declarations
struct mmu_notifier_subscriptionsstruct mmu_notifierstruct mmu_notifier_rangestruct mmu_interval_notifierstruct mmu_notifier_opsstruct mmu_notifierstruct mmu_interval_notifier_finishstruct mmu_interval_notifier_opsstruct mmu_interval_notifierstruct mmu_notifier_rangestruct mmu_notifier_rangeenum mmu_notifier_eventfunction mm_has_notifiersfunction mmu_notifier_getfunction mmu_interval_read_retryfunction mmu_interval_read_beginfunction mmu_interval_read_beginfunction mmu_notifier_range_blockablefunction mmu_notifier_releasefunction mmu_notifier_clear_flush_youngfunction mmu_notifier_clear_youngfunction mmu_notifier_test_youngfunction mmu_notifier_invalidate_range_startfunction mmu_notifier_invalidate_range_startfunction mmu_notifier_invalidate_range_endfunction mmu_notifier_arch_invalidate_secondary_tlbsfunction mmu_notifier_subscriptions_initfunction mmu_notifier_subscriptions_destroyfunction mmu_notifier_range_initfunction mmu_notifier_range_init_ownerfunction _mmu_notifier_range_initfunction mmu_notifier_range_blockablefunction mm_has_notifiersfunction mmu_notifier_releasefunction mmu_notifier_clear_youngfunction mmu_notifier_test_youngfunction mmu_notifier_invalidate_range_startfunction mmu_notifier_invalidate_range_end
Annotated Snippet
struct mmu_notifier_ops {
/*
* Called either by mmu_notifier_unregister or when the mm is
* being destroyed by exit_mmap, always before all pages are
* freed. This can run concurrently with other mmu notifier
* methods (the ones invoked outside the mm context) and it
* should tear down all secondary mmu mappings and freeze the
* secondary mmu. If this method isn't implemented you've to
* be sure that nothing could possibly write to the pages
* through the secondary mmu by the time the last thread with
* tsk->mm == mm exits.
*
* As side note: the pages freed after ->release returns could
* be immediately reallocated by the gart at an alias physical
* address with a different cache model, so if ->release isn't
* implemented because all _software_ driven memory accesses
* through the secondary mmu are terminated by the time the
* last thread of this mm quits, you've also to be sure that
* speculative _hardware_ operations can't allocate dirty
* cachelines in the cpu that could not be snooped and made
* coherent with the other read and write operations happening
* through the gart alias address, so leading to memory
* corruption.
*/
void (*release)(struct mmu_notifier *subscription,
struct mm_struct *mm);
/*
* clear_flush_young is called after the VM is
* test-and-clearing the young/accessed bitflag in the
* pte. This way the VM will provide proper aging to the
* accesses to the page through the secondary MMUs and not
* only to the ones through the Linux pte.
* Start-end is necessary in case the secondary MMU is mapping the page
* at a smaller granularity than the primary MMU.
*/
bool (*clear_flush_young)(struct mmu_notifier *subscription,
struct mm_struct *mm,
unsigned long start,
unsigned long end);
/*
* clear_young is a lightweight version of clear_flush_young. Like the
* latter, it is supposed to test-and-clear the young/accessed bitflag
* in the secondary pte, but it may omit flushing the secondary tlb.
*/
bool (*clear_young)(struct mmu_notifier *subscription,
struct mm_struct *mm,
unsigned long start,
unsigned long end);
/*
* test_young is called to check the young/accessed bitflag in
* the secondary pte. This is used to know if the page is
* frequently used without actually clearing the flag or tearing
* down the secondary mapping on the page.
*/
bool (*test_young)(struct mmu_notifier *subscription,
struct mm_struct *mm,
unsigned long address);
/*
* invalidate_range_start() and invalidate_range_end() must be
* paired and are called only when the mmap_lock and/or the
* locks protecting the reverse maps are held. If the subsystem
* can't guarantee that no additional references are taken to
* the pages in the range, it has to implement the
* invalidate_range() notifier to remove any references taken
* after invalidate_range_start().
*
* Invalidation of multiple concurrent ranges may be
* optionally permitted by the driver. Either way the
* establishment of sptes is forbidden in the range passed to
* invalidate_range_start/end for the whole duration of the
* invalidate_range_start/end critical section.
*
* invalidate_range_start() is called when all pages in the
* range are still mapped and have at least a refcount of one.
*
* invalidate_range_end() is called when all pages in the
* range have been unmapped and the pages have been freed by
* the VM.
*
* The VM will remove the page table entries and potentially
* the page between invalidate_range_start() and
* invalidate_range_end(). If the page must not be freed
* because of pending I/O or other circumstances then the
* invalidate_range_start() callback (or the initial mapping
* by the driver) must make sure that the refcount is kept
* elevated.
Annotation
- Immediate include surface: `linux/list.h`, `linux/spinlock.h`, `linux/mm_types.h`, `linux/mmap_lock.h`, `linux/srcu.h`, `linux/interval_tree.h`.
- Detected declarations: `struct mmu_notifier_subscriptions`, `struct mmu_notifier`, `struct mmu_notifier_range`, `struct mmu_interval_notifier`, `struct mmu_notifier_ops`, `struct mmu_notifier`, `struct mmu_interval_notifier_finish`, `struct mmu_interval_notifier_ops`, `struct mmu_interval_notifier`, `struct mmu_notifier_range`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.