arch/x86/kernel/itmt.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/itmt.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/itmt.c- Extension
.c- Size
- 5081 bytes
- Lines
- 191
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/sched.hlinux/cpumask.hlinux/cpuset.hlinux/debugfs.hlinux/mutex.hlinux/sysctl.hlinux/nodemask.h
Detected Declarations
function sched_itmt_enabled_writefunction sched_core_priority_showfunction sched_set_itmt_supportfunction sched_clear_itmt_supportfunction arch_asym_cpu_priorityfunction sched_set_itmt_core_prio
Annotated Snippet
static const struct file_operations dfs_sched_itmt_fops = {
.read = debugfs_read_file_bool,
.write = sched_itmt_enabled_write,
.open = simple_open,
.llseek = default_llseek,
};
static struct dentry *dfs_sched_itmt;
static struct dentry *dfs_sched_core_prio;
/**
* sched_set_itmt_support() - Indicate platform supports ITMT
*
* This function is used by the OS to indicate to scheduler that the platform
* is capable of supporting the ITMT feature.
*
* The current scheme has the pstate driver detects if the system
* is ITMT capable and call sched_set_itmt_support.
*
* This must be done only after sched_set_itmt_core_prio
* has been called to set the cpus' priorities.
* It must not be called with cpu hot plug lock
* held as we need to acquire the lock to rebuild sched domains
* later.
*
* Return: 0 on success
*/
int sched_set_itmt_support(void)
{
guard(mutex)(&itmt_update_mutex);
if (sched_itmt_capable)
return 0;
dfs_sched_itmt = debugfs_create_file_unsafe("sched_itmt_enabled",
0644,
arch_debugfs_dir,
&sysctl_sched_itmt_enabled,
&dfs_sched_itmt_fops);
if (IS_ERR_OR_NULL(dfs_sched_itmt)) {
dfs_sched_itmt = NULL;
return -ENOMEM;
}
dfs_sched_core_prio = debugfs_create_file("sched_core_priority", 0644,
arch_debugfs_dir, NULL,
&sched_core_priority_fops);
if (IS_ERR_OR_NULL(dfs_sched_core_prio)) {
dfs_sched_core_prio = NULL;
return -ENOMEM;
}
sched_itmt_capable = true;
sysctl_sched_itmt_enabled = 1;
x86_topology_update = true;
rebuild_sched_domains();
return 0;
}
/**
* sched_clear_itmt_support() - Revoke platform's support of ITMT
*
* This function is used by the OS to indicate that it has
* revoked the platform's support of ITMT feature.
*
* It must not be called with cpu hot plug lock
* held as we need to acquire the lock to rebuild sched domains
* later.
*/
void sched_clear_itmt_support(void)
{
guard(mutex)(&itmt_update_mutex);
if (!sched_itmt_capable)
return;
sched_itmt_capable = false;
debugfs_remove(dfs_sched_itmt);
dfs_sched_itmt = NULL;
debugfs_remove(dfs_sched_core_prio);
dfs_sched_core_prio = NULL;
if (sysctl_sched_itmt_enabled) {
/* disable sched_itmt if we are no longer ITMT capable */
sysctl_sched_itmt_enabled = 0;
x86_topology_update = true;
Annotation
- Immediate include surface: `linux/sched.h`, `linux/cpumask.h`, `linux/cpuset.h`, `linux/debugfs.h`, `linux/mutex.h`, `linux/sysctl.h`, `linux/nodemask.h`.
- Detected declarations: `function sched_itmt_enabled_write`, `function sched_core_priority_show`, `function sched_set_itmt_support`, `function sched_clear_itmt_support`, `function arch_asym_cpu_priority`, `function sched_set_itmt_core_prio`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: pattern 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.