tools/testing/selftests/mm/hugetlb-soft-offline.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/mm/hugetlb-soft-offline.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/mm/hugetlb-soft-offline.c- Extension
.c- Size
- 5443 bytes
- Lines
- 229
- 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
errno.hstdlib.hstdio.hstring.hunistd.hlinux/magic.hlinux/memfd.hsys/mman.hsys/statfs.hsys/types.hkselftest.h
Detected Declarations
function do_soft_offlinefunction set_enable_soft_offlinefunction read_nr_hugepagesfunction create_hugetlbfs_filefunction test_soft_offline_commonfunction main
Annotated Snippet
if (nr_hugepages_before != nr_hugepages_after + 1) {
ksft_test_result_fail("MADV_SOFT_OFFLINE should reduced 1 hugepage\n");
return;
}
} else {
if (nr_hugepages_before != nr_hugepages_after) {
ksft_test_result_fail("MADV_SOFT_OFFLINE reduced %lu hugepages\n",
nr_hugepages_before - nr_hugepages_after);
return;
}
}
ksft_test_result(ret == 0,
"Test soft-offline when enabled_soft_offline=%d\n",
enable_soft_offline);
}
int main(int argc, char **argv)
{
ksft_print_header();
ksft_set_plan(2);
test_soft_offline_common(1);
test_soft_offline_common(0);
ksft_finished();
}
Annotation
- Immediate include surface: `errno.h`, `stdlib.h`, `stdio.h`, `string.h`, `unistd.h`, `linux/magic.h`, `linux/memfd.h`, `sys/mman.h`.
- Detected declarations: `function do_soft_offline`, `function set_enable_soft_offline`, `function read_nr_hugepages`, `function create_hugetlbfs_file`, `function test_soft_offline_common`, `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.