Blame view
include/linux/memory.h
3.73 KB
b24413180 License cleanup: ... |
1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
3947be196 [PATCH] memory ho... |
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
/* * include/linux/memory.h - generic memory definition * * This is mainly for topological representation. We define the * basic "struct memory_block" here, which can be embedded in per-arch * definitions or NUMA information. * * Basic handling of the devices is done in drivers/base/memory.c * and system devices are handled in drivers/base/sys.c. * * Memory block are exported via sysfs in the class/memory/devices/ * directory. * */ #ifndef _LINUX_MEMORY_H_ #define _LINUX_MEMORY_H_ |
3947be196 [PATCH] memory ho... |
18 19 |
#include <linux/node.h> #include <linux/compiler.h> |
da19cbcf7 driver core: memo... |
20 |
#include <linux/mutex.h> |
f02c69680 include/linux/mem... |
21 |
#include <linux/notifier.h> |
3947be196 [PATCH] memory ho... |
22 |
|
05cf96398 mm/ia64: fix a me... |
23 |
#define MIN_MEMORY_BLOCK_SIZE (1UL << SECTION_SIZE_BITS) |
a63fdc515 mm: Move definiti... |
24 |
|
3947be196 [PATCH] memory ho... |
25 |
struct memory_block { |
d33601644 memory hotplug: U... |
26 |
unsigned long start_section_nr; |
fa2be40fe drivers: base: us... |
27 |
unsigned long state; /* serialized by the dev->lock */ |
fa2be40fe drivers: base: us... |
28 |
int online_type; /* for passing data to online routine */ |
3947be196 [PATCH] memory ho... |
29 |
int phys_device; /* to which fru does this belong? */ |
10fbcf4c6 convert 'memory' ... |
30 |
struct device dev; |
d0dc12e86 mm/memory_hotplug... |
31 |
int nid; /* NID for this memory block */ |
3947be196 [PATCH] memory ho... |
32 |
}; |
bc32df008 memory hotplug: a... |
33 |
int arch_get_memory_phys_device(unsigned long start_pfn); |
e0a8400c6 memory-hotplug: R... |
34 |
unsigned long memory_block_size_bytes(void); |
f642fb586 x86/platform/UV: ... |
35 |
int set_memory_block_size_order(unsigned int order); |
bc32df008 memory hotplug: a... |
36 |
|
3947be196 [PATCH] memory ho... |
37 38 39 40 |
/* These states are exposed to userspace as text strings in sysfs */ #define MEM_ONLINE (1<<0) /* exposed to userspace */ #define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */ #define MEM_OFFLINE (1<<2) /* exposed to userspace */ |
7b78d335a memory hotplug: r... |
41 42 43 |
#define MEM_GOING_ONLINE (1<<3) #define MEM_CANCEL_ONLINE (1<<4) #define MEM_CANCEL_OFFLINE (1<<5) |
3947be196 [PATCH] memory ho... |
44 |
|
7b78d335a memory hotplug: r... |
45 46 47 |
struct memory_notify { unsigned long start_pfn; unsigned long nr_pages; |
d9713679d memory_hotplug: f... |
48 |
int status_change_nid_normal; |
6715ddf94 hotplug: update n... |
49 |
int status_change_nid_high; |
7b78d335a memory hotplug: r... |
50 51 |
int status_change_nid; }; |
3947be196 [PATCH] memory ho... |
52 |
|
8c65b4a60 [PATCH] fix remai... |
53 54 |
struct notifier_block; struct mem_section; |
0c40ba4fd ipc: define the s... |
55 56 57 58 59 |
/* * Priorities for the hotplug memory callback routines (stored in decreasing * order in the callback chain) */ #define SLAB_CALLBACK_PRI 1 |
b6b337ad1 ipc: recompute ms... |
60 |
#define IPC_CALLBACK_PRI 10 |
0c40ba4fd ipc: define the s... |
61 |
|
53947027a [PATCH] hot-add-m... |
62 |
#ifndef CONFIG_MEMORY_HOTPLUG_SPARSE |
902ce63b3 driver/base/memor... |
63 |
static inline void memory_dev_init(void) |
3947be196 [PATCH] memory ho... |
64 |
{ |
902ce63b3 driver/base/memor... |
65 |
return; |
3947be196 [PATCH] memory ho... |
66 67 68 69 70 71 72 73 |
} static inline int register_memory_notifier(struct notifier_block *nb) { return 0; } static inline void unregister_memory_notifier(struct notifier_block *nb) { } |
7b78d335a memory hotplug: r... |
74 75 76 77 |
static inline int memory_notify(unsigned long val, void *v) { return 0; } |
3947be196 [PATCH] memory ho... |
78 |
#else |
7b78d335a memory hotplug: r... |
79 80 |
extern int register_memory_notifier(struct notifier_block *nb); extern void unregister_memory_notifier(struct notifier_block *nb); |
db051a0da mm/memory_hotplug... |
81 |
int create_memory_block_devices(unsigned long start, unsigned long size); |
4c4b7f9ba mm/memory_hotplug... |
82 |
void remove_memory_block_devices(unsigned long start, unsigned long size); |
902ce63b3 driver/base/memor... |
83 |
extern void memory_dev_init(void); |
7b78d335a memory hotplug: r... |
84 |
extern int memory_notify(unsigned long val, void *v); |
c04fc586c mm: show node to ... |
85 |
extern struct memory_block *find_memory_block(struct mem_section *); |
ea8846411 mm/memory_hotplug... |
86 87 88 |
typedef int (*walk_memory_blocks_func_t)(struct memory_block *, void *); extern int walk_memory_blocks(unsigned long start, unsigned long size, void *arg, walk_memory_blocks_func_t func); |
2c91f8fc6 mm/memory_hotplug... |
89 |
extern int for_each_memory_block(void *arg, walk_memory_blocks_func_t func); |
3947be196 [PATCH] memory ho... |
90 |
#define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) |
53947027a [PATCH] hot-add-m... |
91 |
#endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */ |
3947be196 [PATCH] memory ho... |
92 |
|
b9049e234 memory hotplug: m... |
93 |
#ifdef CONFIG_MEMORY_HOTPLUG |
f02c69680 include/linux/mem... |
94 |
#define hotplug_memory_notifier(fn, pri) ({ \ |
02d0e6753 hotplug_memory_no... |
95 |
static __meminitdata struct notifier_block fn##_mem_nb =\ |
f02c69680 include/linux/mem... |
96 |
{ .notifier_call = fn, .priority = pri };\ |
3947be196 [PATCH] memory ho... |
97 |
register_memory_notifier(&fn##_mem_nb); \ |
f02c69680 include/linux/mem... |
98 99 100 |
}) #define register_hotmemory_notifier(nb) register_memory_notifier(nb) #define unregister_hotmemory_notifier(nb) unregister_memory_notifier(nb) |
b9049e234 memory hotplug: m... |
101 |
#else |
ace6128d6 memory hotplug: f... |
102 |
#define hotplug_memory_notifier(fn, pri) ({ 0; }) |
f02c69680 include/linux/mem... |
103 104 105 |
/* These aren't inline functions due to a GCC bug. */ #define register_hotmemory_notifier(nb) ({ (void)(nb); 0; }) #define unregister_hotmemory_notifier(nb) ({ (void)(nb); }) |
b9049e234 memory hotplug: m... |
106 |
#endif |
3947be196 [PATCH] memory ho... |
107 |
|
06c421ee0 memory_accessor: ... |
108 |
/* |
0e39ac444 tracing, Text Edi... |
109 110 111 112 |
* Kernel text modification mutex, used for code patching. Users of this lock * can sleep. */ extern struct mutex text_mutex; |
3947be196 [PATCH] memory ho... |
113 |
#endif /* _LINUX_MEMORY_H_ */ |