mm/zsmalloc.c
Source file repositories/reference/linux-study-clean/mm/zsmalloc.c
File Facts
- System
- Linux kernel
- Corpus path
mm/zsmalloc.c- Extension
.c- Size
- 56866 bytes
- Lines
- 2272
- Domain
- Core OS
- Bucket
- Memory Management
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration 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.
- 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/module.hlinux/kernel.hlinux/sched.hlinux/errno.hlinux/highmem.hlinux/string.hlinux/slab.hlinux/scatterlist.hlinux/spinlock.hlinux/sprintf.hlinux/shrinker.hlinux/types.hlinux/debugfs.hlinux/zsmalloc.hlinux/fs.hlinux/workqueue.hzpdesc.h
Detected Declarations
struct zs_size_statstruct size_classstruct link_freestruct zs_poolstruct zspage_lockstruct zspageenum fullness_groupenum class_stat_typefunction zpdesc_set_firstfunction zpdesc_inc_zone_page_statefunction zpdesc_dec_zone_page_statefunction free_zpdescfunction zspage_lock_initfunction writersfunction zspage_read_unlockfunction zspage_write_trylockfunction zspage_write_unlockfunction SetZsHugePagefunction ZsHugePagefunction kick_deferred_freefunction cache_free_handlefunction cache_free_zspagefunction record_objfunction is_first_zpdescfunction get_zspage_inusefunction mod_zspage_inusefunction get_first_obj_offsetfunction set_first_obj_offsetfunction get_freeobjfunction set_freeobjfunction get_size_class_indexfunction class_stat_addfunction class_stat_subfunction class_stat_readfunction zs_stat_initfunction zs_stat_exitfunction zs_stats_size_showfunction zs_pool_stat_createfunction zs_pool_stat_destroyfunction zs_stat_initfunction insert_zspagefunction remove_zspagefunction fix_fullness_groupfunction obj_to_locationfunction obj_to_zpdescfunction location_to_objfunction handle_to_objfunction obj_allocated
Annotated Snippet
module_init(zs_init);
module_exit(zs_exit);
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("Nitin Gupta <ngupta@vflare.org>");
MODULE_DESCRIPTION("zsmalloc memory allocator");
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/sched.h`, `linux/errno.h`, `linux/highmem.h`, `linux/string.h`, `linux/slab.h`, `linux/scatterlist.h`.
- Detected declarations: `struct zs_size_stat`, `struct size_class`, `struct link_free`, `struct zs_pool`, `struct zspage_lock`, `struct zspage`, `enum fullness_group`, `enum class_stat_type`, `function zpdesc_set_first`, `function zpdesc_inc_zone_page_state`.
- Atlas domain: Core OS / Memory Management.
- 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.