tools/sched_ext/scx_qmap.c
Source file repositories/reference/linux-study-clean/tools/sched_ext/scx_qmap.c
File Facts
- System
- Linux kernel
- Corpus path
tools/sched_ext/scx_qmap.c- Extension
.c- Size
- 7041 bytes
- Lines
- 234
- 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
stdio.hstdlib.hunistd.hinttypes.hsignal.hlibgen.hsys/mman.hsys/stat.hbpf/bpf.hscx/common.hscx_qmap.hscx_qmap.bpf.skel.h
Detected Declarations
function libbpf_print_fnfunction sigint_handlerfunction main
Annotated Snippet
switch (opt) {
case 's':
skel->rodata->slice_ns = strtoull(optarg, NULL, 0) * 1000;
break;
case 'e':
test_error_cnt = strtoul(optarg, NULL, 0);
break;
case 't':
skel->rodata->stall_user_nth = strtoul(optarg, NULL, 0);
break;
case 'T':
skel->rodata->stall_kernel_nth = strtoul(optarg, NULL, 0);
break;
case 'l':
skel->rodata->dsp_inf_loop_after = strtoul(optarg, NULL, 0);
break;
case 'b':
skel->rodata->dsp_batch = strtoul(optarg, NULL, 0);
break;
case 'N':
skel->rodata->max_tasks = strtoul(optarg, NULL, 0);
break;
case 'P':
skel->rodata->print_dsqs_and_events = true;
break;
case 'M':
skel->rodata->print_msgs = true;
break;
case 'H':
skel->rodata->highpri_boosting = true;
break;
case 'c': {
struct stat st;
if (stat(optarg, &st) < 0) {
perror("stat");
return 1;
}
skel->struct_ops.qmap_ops->sub_cgroup_id = st.st_ino;
skel->rodata->sub_cgroup_id = st.st_ino;
break;
}
case 'd':
skel->rodata->disallow_tgid = strtol(optarg, NULL, 0);
if (skel->rodata->disallow_tgid < 0)
skel->rodata->disallow_tgid = getpid();
break;
case 'D':
skel->struct_ops.qmap_ops->exit_dump_len = strtoul(optarg, NULL, 0);
break;
case 'S':
skel->rodata->suppress_dump = true;
break;
case 'p':
skel->struct_ops.qmap_ops->flags |= SCX_OPS_SWITCH_PARTIAL;
break;
case 'I':
skel->rodata->always_enq_immed = true;
skel->struct_ops.qmap_ops->flags |= SCX_OPS_ALWAYS_ENQ_IMMED;
break;
case 'F':
skel->rodata->immed_stress_nth = strtoul(optarg, NULL, 0);
break;
case 'C': {
u32 nr_cpus = libbpf_num_possible_cpus();
u32 mode, i;
if (!strcmp(optarg, "shuffle"))
mode = 1;
else if (!strcmp(optarg, "bad-dup"))
mode = 2;
else if (!strcmp(optarg, "bad-range"))
mode = 3;
else {
fprintf(stderr, "unknown cid-override mode '%s'\n", optarg);
return 1;
}
skel->rodata->cid_override_mode = mode;
/* shuffle: reversed cpu_to_cid, bad-dup: dup cid 0, bad-range: identity */
for (i = 0; i < nr_cpus; i++) {
if (mode == 1)
skel->bss->cid_override_cpu_to_cid[i] = nr_cpus - 1 - i;
else
skel->bss->cid_override_cpu_to_cid[i] = i;
}
if (mode == 2 && nr_cpus >= 2)
skel->bss->cid_override_cpu_to_cid[1] = 0;
if (mode == 3)
skel->bss->cid_override_cpu_to_cid[0] = (s32)nr_cpus;
break;
Annotation
- Immediate include surface: `stdio.h`, `stdlib.h`, `unistd.h`, `inttypes.h`, `signal.h`, `libgen.h`, `sys/mman.h`, `sys/stat.h`.
- Detected declarations: `function libbpf_print_fn`, `function sigint_handler`, `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.