tools/perf/bench/numa.c
Source file repositories/reference/linux-study-clean/tools/perf/bench/numa.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/bench/numa.c- Extension
.c- Size
- 47700 bytes
- Lines
- 1978
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
inttypes.hsubcmd/parse-options.h../util/cloexec.hbench.herrno.hsched.hstdio.hassert.hdebug.hmalloc.hsignal.hstdlib.hstring.hunistd.hsys/mman.hsys/time.hsys/resource.hsys/wait.hsys/prctl.hsys/stat.hsys/types.hlinux/kernel.hlinux/time64.hlinux/numa.h../util/header.h../util/mutex.hapi/fs/fs.hnuma.hnumaif.h
Detected Declarations
struct thread_datastruct paramsstruct global_infofunction nr_numa_nodesfunction is_node_presentfunction node_has_cpusfunction bind_to_cpumaskfunction mempol_restorefunction bind_to_memnodefunction free_datafunction zalloc_shared_datafunction setup_shared_datafunction setup_private_datafunction parse_cpu_listfunction is_cpu_onlinefunction parse_setup_cpu_listfunction parse_cpus_optfunction parse_node_listfunction parse_setup_node_listfunction parse_nodes_optfunction lfsr_32function kernelfunction do_workfunction update_curr_cpufunction count_process_nodesfunction count_node_processesfunction calc_convergence_compressionfunction calc_convergencefunction show_summaryfunction worker_processfunction print_summaryfunction init_thread_datafunction deinit_thread_datafunction initfunction deinitfunction print_resfunction __bench_numafunction command_sizefunction init_paramsfunction run_bench_numafunction bench_allfunction bench_numa
Annotated Snippet
struct thread_data {
int curr_cpu;
cpu_set_t *bind_cpumask;
int bind_node;
u8 *process_data;
int process_nr;
int thread_nr;
int task_nr;
unsigned int loops_done;
u64 val;
u64 runtime_ns;
u64 system_time_ns;
u64 user_time_ns;
double speed_gbs;
struct mutex *process_lock;
};
/* Parameters set by options: */
struct params {
/* Startup synchronization: */
bool serialize_startup;
/* Task hierarchy: */
int nr_proc;
int nr_threads;
/* Working set sizes: */
const char *mb_global_str;
const char *mb_proc_str;
const char *mb_proc_locked_str;
const char *mb_thread_str;
double mb_global;
double mb_proc;
double mb_proc_locked;
double mb_thread;
/* Access patterns to the working set: */
bool data_reads;
bool data_writes;
bool data_backwards;
bool data_zero_memset;
bool data_rand_walk;
u32 nr_loops;
u32 nr_secs;
u32 sleep_usecs;
/* Working set initialization: */
bool init_zero;
bool init_random;
bool init_cpu0;
/* Misc options: */
int show_details;
int run_all;
int thp;
long bytes_global;
long bytes_process;
long bytes_process_locked;
long bytes_thread;
int nr_tasks;
bool show_convergence;
bool measure_convergence;
int perturb_secs;
int nr_cpus;
int nr_nodes;
/* Affinity options -C and -N: */
char *cpu_list_str;
char *node_list_str;
};
/* Global, read-writable area, accessible to all processes and threads: */
struct global_info {
u8 *data;
struct mutex startup_mutex;
struct cond startup_cond;
int nr_tasks_started;
struct mutex start_work_mutex;
struct cond start_work_cond;
int nr_tasks_working;
Annotation
- Immediate include surface: `inttypes.h`, `subcmd/parse-options.h`, `../util/cloexec.h`, `bench.h`, `errno.h`, `sched.h`, `stdio.h`, `assert.h`.
- Detected declarations: `struct thread_data`, `struct params`, `struct global_info`, `function nr_numa_nodes`, `function is_node_present`, `function node_has_cpus`, `function bind_to_cpumask`, `function mempol_restore`, `function bind_to_memnode`, `function free_data`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.