kernel/time/tick-oneshot.c
Source file repositories/reference/linux-study-clean/kernel/time/tick-oneshot.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/time/tick-oneshot.c- Extension
.c- Size
- 4208 bytes
- Lines
- 147
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cpu.hlinux/err.hlinux/hrtimer.hlinux/interrupt.hlinux/percpu.hlinux/profile.hlinux/sched.htick-internal.h
Detected Declarations
function Copyrightfunction tick_resume_oneshotfunction tick_setup_oneshotfunction tick_switch_to_oneshotfunction tick_oneshot_mode_activefunction tick_init_highres
Annotated Snippet
if (!dev) {
pr_cont(" no tick device\n");
} else {
if (!tick_device_is_functional(dev))
pr_cont(" %s is not functional.\n", dev->name);
else
pr_cont(" %s does not support one-shot mode.\n",
dev->name);
}
return -EINVAL;
}
td->mode = TICKDEV_MODE_ONESHOT;
dev->event_handler = handler;
clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT);
tick_broadcast_switch_to_oneshot();
return 0;
}
/**
* tick_oneshot_mode_active - check whether the system is in oneshot mode
*
* Return: 1 when either nohz or highres are enabled, otherwise 0.
*/
int tick_oneshot_mode_active(void)
{
unsigned long flags;
int ret;
local_irq_save(flags);
ret = __this_cpu_read(tick_cpu_device.mode) == TICKDEV_MODE_ONESHOT;
local_irq_restore(flags);
return ret;
}
#ifdef CONFIG_HIGH_RES_TIMERS
/**
* tick_init_highres - switch to high resolution mode
*
* Called with interrupts disabled.
*
* Return: 0 on success, -EINVAL if the tick device cannot switch
* to oneshot/high-resolution mode.
*/
int tick_init_highres(void)
{
return tick_switch_to_oneshot(hrtimer_interrupt);
}
#endif
Annotation
- Immediate include surface: `linux/cpu.h`, `linux/err.h`, `linux/hrtimer.h`, `linux/interrupt.h`, `linux/percpu.h`, `linux/profile.h`, `linux/sched.h`, `tick-internal.h`.
- Detected declarations: `function Copyright`, `function tick_resume_oneshot`, `function tick_setup_oneshot`, `function tick_switch_to_oneshot`, `function tick_oneshot_mode_active`, `function tick_init_highres`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- 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.