tools/testing/selftests/mm/uffd-wp-mremap.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/mm/uffd-wp-mremap.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/mm/uffd-wp-mremap.c- Extension
.c- Size
- 8584 bytes
- Lines
- 381
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdbool.hstdint.hfcntl.hassert.hlinux/mman.hsys/mman.hkselftest.hthp_settings.huffd-common.h
Detected Declarations
struct testcasefunction detect_thp_sizesfunction check_uffd_wp_statefunction range_is_swappedfunction test_one_foliofunction main
Annotated Snippet
struct testcase {
size_t *sizes;
int *nr_sizes;
bool private;
bool swapout;
bool hugetlb;
};
static const struct testcase testcases[] = {
/* base pages. */
{
.sizes = &pagesize,
.nr_sizes = &nr_pagesizes,
.private = false,
.swapout = false,
.hugetlb = false,
},
{
.sizes = &pagesize,
.nr_sizes = &nr_pagesizes,
.private = true,
.swapout = false,
.hugetlb = false,
},
{
.sizes = &pagesize,
.nr_sizes = &nr_pagesizes,
.private = false,
.swapout = true,
.hugetlb = false,
},
{
.sizes = &pagesize,
.nr_sizes = &nr_pagesizes,
.private = true,
.swapout = true,
.hugetlb = false,
},
/* thp. */
{
.sizes = thpsizes,
.nr_sizes = &nr_thpsizes,
.private = false,
.swapout = false,
.hugetlb = false,
},
{
.sizes = thpsizes,
.nr_sizes = &nr_thpsizes,
.private = true,
.swapout = false,
.hugetlb = false,
},
{
.sizes = thpsizes,
.nr_sizes = &nr_thpsizes,
.private = false,
.swapout = true,
.hugetlb = false,
},
{
.sizes = thpsizes,
.nr_sizes = &nr_thpsizes,
.private = true,
.swapout = true,
.hugetlb = false,
},
/* hugetlb. */
{
.sizes = hugetlbsizes,
.nr_sizes = &nr_hugetlbsizes,
.private = false,
.swapout = false,
.hugetlb = true,
},
{
.sizes = hugetlbsizes,
.nr_sizes = &nr_hugetlbsizes,
.private = true,
.swapout = false,
.hugetlb = true,
},
};
int main(int argc, char **argv)
{
uffd_global_test_opts_t gopts = { 0 };
struct thp_settings settings;
Annotation
- Immediate include surface: `stdbool.h`, `stdint.h`, `fcntl.h`, `assert.h`, `linux/mman.h`, `sys/mman.h`, `kselftest.h`, `thp_settings.h`.
- Detected declarations: `struct testcase`, `function detect_thp_sizes`, `function check_uffd_wp_state`, `function range_is_swapped`, `function test_one_folio`, `function main`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.