Documentation/admin-guide/workload-tracing.rst
Source file repositories/reference/linux-study-clean/Documentation/admin-guide/workload-tracing.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/admin-guide/workload-tracing.rst- Extension
.rst- Size
- 34560 bytes
- Lines
- 624
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
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.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
.. SPDX-License-Identifier: (GPL-2.0+ OR CC-BY-4.0)
======================================================
Discovering Linux kernel subsystems used by a workload
======================================================
:Authors: - Shuah Khan <skhan@linuxfoundation.org>
- Shefali Sharma <sshefali021@gmail.com>
:maintained-by: Shuah Khan <skhan@linuxfoundation.org>
Key Points
==========
* Understanding system resources necessary to build and run a workload
is important.
* Linux tracing and strace can be used to discover the system resources
in use by a workload. The completeness of the system usage information
depends on the completeness of coverage of a workload.
* Performance and security of the operating system can be analyzed with
the help of tools such as:
`perf <https://man7.org/linux/man-pages/man1/perf.1.html>`_,
`stress-ng <https://www.mankier.com/1/stress-ng>`_,
`paxtest <https://github.com/opntr/paxtest-freebsd>`_.
* Once we discover and understand the workload needs, we can focus on them
to avoid regressions and use it to evaluate safety considerations.
Methodology
===========
`strace <https://man7.org/linux/man-pages/man1/strace.1.html>`_ is a
diagnostic, instructional, and debugging tool and can be used to discover
the system resources in use by a workload. Once we discover and understand
the workload needs, we can focus on them to avoid regressions and use it
to evaluate safety considerations. We use strace tool to trace workloads.
This method of tracing using strace tells us the system calls invoked by
the workload and doesn't include all the system calls that can be invoked
by it. In addition, this tracing method tells us just the code paths within
these system calls that are invoked. As an example, if a workload opens a
file and reads from it successfully, then the success path is the one that
is traced. Any error paths in that system call will not be traced. If there
is a workload that provides full coverage of a workload then the method
outlined here will trace and find all possible code paths. The completeness
of the system usage information depends on the completeness of coverage of a
workload.
The goal is tracing a workload on a system running a default kernel without
requiring custom kernel installs.
How do we gather fine-grained system information?
=================================================
strace tool can be used to trace system calls made by a process and signals
it receives. System calls are the fundamental interface between an
application and the operating system kernel. They enable a program to
request services from the kernel. For instance, the open() system call in
Linux is used to provide access to a file in the file system. strace enables
us to track all the system calls made by an application. It lists all the
system calls made by a process and their resulting output.
You can generate profiling data combining strace and perf record tools to
record the events and information associated with a process. This provides
insight into the process. "perf annotate" tool generates the statistics of
each instruction of the program. This document goes over the details of how
to gather fine-grained information on a workload's usage of system resources.
We used strace to trace the perf, stress-ng, paxtest workloads to illustrate
our methodology to discover resources used by a workload. This process can
be applied to trace other workloads.
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
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.