include/linux/memory_hotplug.h
Source file repositories/reference/linux-study-clean/include/linux/memory_hotplug.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/memory_hotplug.h- Extension
.h- Size
- 10288 bytes
- Lines
- 322
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mmzone.hlinux/spinlock.hlinux/notifier.hlinux/bug.h
Detected Declarations
struct pagestruct zonestruct pglist_datastruct mem_sectionstruct memory_groupstruct resourcestruct vmem_altmapstruct dev_pagemapstruct mhp_paramsenum mmopfunction zone_span_writelockfunction zone_span_seqretryfunction zone_span_writelockfunction zone_span_writeunlockfunction zone_seqlock_initfunction movable_node_is_enabledfunction add_pagesfunction pgdat_kswapd_lockfunction pgdat_kswapd_unlockfunction pgdat_kswapd_lock_initfunction zone_span_seqbeginfunction zone_span_seqretryfunction zone_span_writelockfunction get_online_memsfunction mhp_supports_memmap_on_memoryfunction pgdat_kswapd_lockfunction pgdat_resize_lockfunction pgdat_resize_unlockfunction pgdat_resize_initfunction pgdat_resize_lockfunction try_offline_nodefunction remove_memoryfunction __remove_memory
Annotated Snippet
struct mhp_params {
struct vmem_altmap *altmap;
pgprot_t pgprot;
struct dev_pagemap *pgmap;
};
bool mhp_range_allowed(u64 start, u64 size, bool need_mapping);
struct range mhp_get_pluggable_range(bool need_mapping);
bool mhp_supports_memmap_on_memory(void);
/*
* Zone resizing functions
*
* Note: any attempt to resize a zone should has pgdat_resize_lock()
* zone_span_writelock() both held. This ensure the size of a zone
* can't be changed while pgdat_resize_lock() held.
*/
static inline unsigned zone_span_seqbegin(struct zone *zone)
{
return read_seqbegin(&zone->span_seqlock);
}
static inline int zone_span_seqretry(struct zone *zone, unsigned iv)
{
return read_seqretry(&zone->span_seqlock, iv);
}
static inline void zone_span_writelock(struct zone *zone)
{
write_seqlock(&zone->span_seqlock);
}
static inline void zone_span_writeunlock(struct zone *zone)
{
write_sequnlock(&zone->span_seqlock);
}
static inline void zone_seqlock_init(struct zone *zone)
{
seqlock_init(&zone->span_seqlock);
}
extern void adjust_present_page_count(struct page *page,
struct memory_group *group,
long nr_pages);
/* VM interface that may be used by firmware interface */
extern int mhp_init_memmap_on_memory(unsigned long pfn, unsigned long nr_pages,
struct zone *zone);
extern void mhp_deinit_memmap_on_memory(unsigned long pfn, unsigned long nr_pages);
extern int online_pages(unsigned long pfn, unsigned long nr_pages,
struct zone *zone, struct memory_group *group);
extern unsigned long __offline_isolated_pages(unsigned long start_pfn,
unsigned long end_pfn);
typedef void (*online_page_callback_t)(struct page *page, unsigned int order);
extern void generic_online_page(struct page *page, unsigned int order);
extern int set_online_page_callback(online_page_callback_t callback);
extern int restore_online_page_callback(online_page_callback_t callback);
extern int try_online_node(int nid);
extern int arch_add_memory(int nid, u64 start, u64 size,
struct mhp_params *params);
extern u64 max_mem_size;
extern int mhp_online_type_from_str(const char *str);
/* If movable_node boot option specified */
extern bool movable_node_enabled;
static inline bool movable_node_is_enabled(void)
{
return movable_node_enabled;
}
extern void arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap,
struct dev_pagemap *pgmap);
extern void __remove_pages(unsigned long start_pfn, unsigned long nr_pages,
struct vmem_altmap *altmap, struct dev_pagemap *pgmap);
/* reasonably generic interface to expand the physical pages */
extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
struct mhp_params *params);
#ifndef CONFIG_ARCH_HAS_ADD_PAGES
static inline int add_pages(int nid, unsigned long start_pfn,
unsigned long nr_pages, struct mhp_params *params)
{
return __add_pages(nid, start_pfn, nr_pages, params);
}
#else /* ARCH_HAS_ADD_PAGES */
int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages,
struct mhp_params *params);
#endif /* ARCH_HAS_ADD_PAGES */
Annotation
- Immediate include surface: `linux/mmzone.h`, `linux/spinlock.h`, `linux/notifier.h`, `linux/bug.h`.
- Detected declarations: `struct page`, `struct zone`, `struct pglist_data`, `struct mem_section`, `struct memory_group`, `struct resource`, `struct vmem_altmap`, `struct dev_pagemap`, `struct mhp_params`, `enum mmop`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source 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.