mm/tests/lazy_mmu_mode_kunit.c
Source file repositories/reference/linux-study-clean/mm/tests/lazy_mmu_mode_kunit.c
File Facts
- System
- Linux kernel
- Corpus path
mm/tests/lazy_mmu_mode_kunit.c- Extension
.c- Size
- 1405 bytes
- Lines
- 74
- Domain
- Core OS
- Bucket
- Memory Management
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
kunit/test.hlinux/pgtable.h
Detected Declarations
function expect_not_activefunction expect_activefunction lazy_mmu_mode_active
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
#include <kunit/test.h>
#include <linux/pgtable.h>
MODULE_IMPORT_NS("EXPORTED_FOR_KUNIT_TESTING");
static void expect_not_active(struct kunit *test)
{
KUNIT_EXPECT_FALSE(test, is_lazy_mmu_mode_active());
}
static void expect_active(struct kunit *test)
{
KUNIT_EXPECT_TRUE(test, is_lazy_mmu_mode_active());
}
static void lazy_mmu_mode_active(struct kunit *test)
{
expect_not_active(test);
lazy_mmu_mode_enable();
expect_active(test);
{
/* Nested section */
lazy_mmu_mode_enable();
expect_active(test);
lazy_mmu_mode_disable();
expect_active(test);
}
{
/* Paused section */
lazy_mmu_mode_pause();
expect_not_active(test);
{
/* No effect (paused) */
lazy_mmu_mode_enable();
expect_not_active(test);
lazy_mmu_mode_disable();
expect_not_active(test);
lazy_mmu_mode_pause();
expect_not_active(test);
lazy_mmu_mode_resume();
expect_not_active(test);
}
lazy_mmu_mode_resume();
expect_active(test);
}
lazy_mmu_mode_disable();
expect_not_active(test);
}
static struct kunit_case lazy_mmu_mode_test_cases[] = {
KUNIT_CASE(lazy_mmu_mode_active),
{}
};
static struct kunit_suite lazy_mmu_mode_test_suite = {
.name = "lazy_mmu_mode",
.test_cases = lazy_mmu_mode_test_cases,
};
kunit_test_suite(lazy_mmu_mode_test_suite);
MODULE_DESCRIPTION("Tests for the lazy MMU mode");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `kunit/test.h`, `linux/pgtable.h`.
- Detected declarations: `function expect_not_active`, `function expect_active`, `function lazy_mmu_mode_active`.
- Atlas domain: Core OS / Memory Management.
- 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.