drivers/misc/vmw_balloon.c
Source file repositories/reference/linux-study-clean/drivers/misc/vmw_balloon.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/vmw_balloon.c- Extension
.c- Size
- 52860 bytes
- Lines
- 1874
- Domain
- Driver Families
- Bucket
- drivers/misc
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/io.hlinux/kernel.hlinux/mm.hlinux/vmalloc.hlinux/sched.hlinux/module.hlinux/workqueue.hlinux/debugfs.hlinux/seq_file.hlinux/rwsem.hlinux/slab.hlinux/spinlock.hlinux/balloon.hlinux/vmw_vmci_defs.hlinux/vmw_vmci_api.hasm/hypervisor.h
Detected Declarations
struct vmballoon_ctlstruct vmballoon_batch_entrystruct vmballoonstruct vmballoon_statsenum vmwballoon_capabilitiesenum vmballoon_page_size_typeenum vmballoon_openum vmballoon_op_stat_typeenum vmballoon_cmd_typeenum vmballoon_error_codesenum vmballoon_stat_pageenum vmballoon_stat_generalfunction is_vmballoon_stats_onfunction vmballoon_stats_op_incfunction vmballoon_stats_gen_incfunction vmballoon_stats_gen_addfunction vmballoon_stats_page_incfunction vmballoon_stats_page_addfunction __vmballoon_cmdfunction vmballoon_cmdfunction vmballoon_send_startfunction vmballoon_send_guest_idfunction vmballoon_page_orderfunction vmballoon_page_in_framesfunction vmballoon_mark_page_offlinefunction vmballoon_mark_page_onlinefunction vmballoon_send_get_targetfunction vmballoon_alloc_page_listfunction vmballoon_handle_one_resultfunction vmballoon_status_pagefunction pagefunction vmballoon_add_pagefunction pagesfunction vmballoon_release_page_listfunction list_for_each_entry_safefunction vmballoon_release_refused_pagesfunction vmballoon_changefunction vmballoon_enqueue_page_listfunction list_for_each_entryfunction vmballoon_dequeue_page_listfunction vmballoon_split_refused_pagesfunction list_for_each_entry_safefunction vmballoon_inflatefunction vmballoon_deflatefunction vmballoon_deinit_batchingfunction vmballoon_init_batchingfunction vmballoon_doorbellfunction vmballoon_vmci_cleanup
Annotated Snippet
* Using late_initcall() instead of module_init() allows the balloon to use the
* VMCI doorbell even when the balloon is built into the kernel. Otherwise the
* VMCI is probed only after the balloon is initialized. If the balloon is used
* as a module, late_initcall() is equivalent to module_init().
*/
late_initcall(vmballoon_init);
static void __exit vmballoon_exit(void)
{
vmballoon_unregister_shrinker(&balloon);
vmballoon_vmci_cleanup(&balloon);
cancel_delayed_work_sync(&balloon.dwork);
vmballoon_debugfs_exit(&balloon);
/*
* Deallocate all reserved memory, and reset connection with monitor.
* Reset connection before deallocating memory to avoid potential for
* additional spurious resets from guest touching deallocated pages.
*/
vmballoon_send_start(&balloon, 0);
vmballoon_pop(&balloon);
}
module_exit(vmballoon_exit);
Annotation
- Immediate include surface: `linux/types.h`, `linux/io.h`, `linux/kernel.h`, `linux/mm.h`, `linux/vmalloc.h`, `linux/sched.h`, `linux/module.h`, `linux/workqueue.h`.
- Detected declarations: `struct vmballoon_ctl`, `struct vmballoon_batch_entry`, `struct vmballoon`, `struct vmballoon_stats`, `enum vmwballoon_capabilities`, `enum vmballoon_page_size_type`, `enum vmballoon_op`, `enum vmballoon_op_stat_type`, `enum vmballoon_cmd_type`, `enum vmballoon_error_codes`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: integration 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.