drivers/cpuidle/governors/haltpoll.c
Source file repositories/reference/linux-study-clean/drivers/cpuidle/governors/haltpoll.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/cpuidle/governors/haltpoll.c- Extension
.c- Size
- 3962 bytes
- Lines
- 156
- Domain
- Driver Families
- Bucket
- drivers/cpuidle
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/cpuidle.hlinux/time.hlinux/ktime.hlinux/hrtimer.hlinux/tick.hlinux/sched.hlinux/module.hlinux/kvm_para.htrace/events/power.h
Detected Declarations
function haltpoll_selectfunction adjust_poll_limitfunction haltpoll_reflectfunction haltpoll_enable_devicefunction init_haltpoll
Annotated Snippet
if (shrink == 0) {
val = 0;
} else {
val /= shrink;
/* Reset value to 0 if shrunk below grow_start */
if (val < guest_halt_poll_grow_start)
val = 0;
}
trace_guest_halt_poll_ns_shrink(val, dev->poll_limit_ns);
dev->poll_limit_ns = val;
}
}
/**
* haltpoll_reflect - update variables and update poll time
* @dev: the CPU
* @index: the index of actual entered state
*/
static void haltpoll_reflect(struct cpuidle_device *dev, int index)
{
dev->last_state_idx = index;
if (index != 0)
adjust_poll_limit(dev, dev->last_residency_ns);
}
/**
* haltpoll_enable_device - scans a CPU's states and does setup
* @drv: cpuidle driver
* @dev: the CPU
*/
static int haltpoll_enable_device(struct cpuidle_driver *drv,
struct cpuidle_device *dev)
{
dev->poll_limit_ns = 0;
return 0;
}
static struct cpuidle_governor haltpoll_governor = {
.name = "haltpoll",
.rating = 9,
.enable = haltpoll_enable_device,
.select = haltpoll_select,
.reflect = haltpoll_reflect,
};
static int __init init_haltpoll(void)
{
if (kvm_para_available())
return cpuidle_register_governor(&haltpoll_governor);
return 0;
}
postcore_initcall(init_haltpoll);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/cpuidle.h`, `linux/time.h`, `linux/ktime.h`, `linux/hrtimer.h`, `linux/tick.h`, `linux/sched.h`, `linux/module.h`.
- Detected declarations: `function haltpoll_select`, `function adjust_poll_limit`, `function haltpoll_reflect`, `function haltpoll_enable_device`, `function init_haltpoll`.
- Atlas domain: Driver Families / drivers/cpuidle.
- Implementation status: integration 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.