mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 06:12:08 +00:00
mm/memblock: add physical memory list
Add the physmem list to the memblock structure. This list only exists if HAVE_MEMBLOCK_PHYS_MAP is selected and contains the unmodified list of physically available memory. It differs from the memblock memory list as it always contains all memory ranges even if the memory has been restricted, e.g. by use of the mem= kernel parameter. Signed-off-by: Philipp Hachtmann <phacht@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
f1af9d3af3
commit
70210ed950
@ -18,6 +18,7 @@
|
|||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
|
|
||||||
#define INIT_MEMBLOCK_REGIONS 128
|
#define INIT_MEMBLOCK_REGIONS 128
|
||||||
|
#define INIT_PHYSMEM_REGIONS 4
|
||||||
|
|
||||||
/* Definition of memblock flags. */
|
/* Definition of memblock flags. */
|
||||||
#define MEMBLOCK_HOTPLUG 0x1 /* hotpluggable region */
|
#define MEMBLOCK_HOTPLUG 0x1 /* hotpluggable region */
|
||||||
@ -43,6 +44,9 @@ struct memblock {
|
|||||||
phys_addr_t current_limit;
|
phys_addr_t current_limit;
|
||||||
struct memblock_type memory;
|
struct memblock_type memory;
|
||||||
struct memblock_type reserved;
|
struct memblock_type reserved;
|
||||||
|
#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
|
||||||
|
struct memblock_type physmem;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct memblock memblock;
|
extern struct memblock memblock;
|
||||||
|
@ -134,6 +134,9 @@ config HAVE_MEMBLOCK
|
|||||||
config HAVE_MEMBLOCK_NODE_MAP
|
config HAVE_MEMBLOCK_NODE_MAP
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
config HAVE_MEMBLOCK_PHYS_MAP
|
||||||
|
boolean
|
||||||
|
|
||||||
config ARCH_DISCARD_MEMBLOCK
|
config ARCH_DISCARD_MEMBLOCK
|
||||||
boolean
|
boolean
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
|
|
||||||
static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
|
static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
|
||||||
static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
|
static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
|
||||||
|
#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
|
||||||
|
static struct memblock_region memblock_physmem_init_regions[INIT_PHYSMEM_REGIONS] __initdata_memblock;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct memblock memblock __initdata_memblock = {
|
struct memblock memblock __initdata_memblock = {
|
||||||
.memory.regions = memblock_memory_init_regions,
|
.memory.regions = memblock_memory_init_regions,
|
||||||
@ -37,6 +40,12 @@ struct memblock memblock __initdata_memblock = {
|
|||||||
.reserved.cnt = 1, /* empty dummy entry */
|
.reserved.cnt = 1, /* empty dummy entry */
|
||||||
.reserved.max = INIT_MEMBLOCK_REGIONS,
|
.reserved.max = INIT_MEMBLOCK_REGIONS,
|
||||||
|
|
||||||
|
#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
|
||||||
|
.physmem.regions = memblock_physmem_init_regions,
|
||||||
|
.physmem.cnt = 1, /* empty dummy entry */
|
||||||
|
.physmem.max = INIT_PHYSMEM_REGIONS,
|
||||||
|
#endif
|
||||||
|
|
||||||
.bottom_up = false,
|
.bottom_up = false,
|
||||||
.current_limit = MEMBLOCK_ALLOC_ANYWHERE,
|
.current_limit = MEMBLOCK_ALLOC_ANYWHERE,
|
||||||
};
|
};
|
||||||
@ -1553,6 +1562,9 @@ static int __init memblock_init_debugfs(void)
|
|||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
|
debugfs_create_file("memory", S_IRUGO, root, &memblock.memory, &memblock_debug_fops);
|
||||||
debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);
|
debugfs_create_file("reserved", S_IRUGO, root, &memblock.reserved, &memblock_debug_fops);
|
||||||
|
#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
|
||||||
|
debugfs_create_file("physmem", S_IRUGO, root, &memblock.physmem, &memblock_debug_fops);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user