memblock: Track total size of regions automatically
Total size of memory regions was calculated by memblock_analyze() requiring explicitly calling the function between operations which can change memory regions and possible users of total size, which is cumbersome and fragile. This patch makes each memblock_type track total size automatically with minor modifications to memblock manipulation functions and remove requirements on calling memblock_analyze(). [__]memblock_dump_all() now also dumps the total size of reserved regions. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Yinghai Lu <yinghai@kernel.org>
This commit is contained in:
@@ -30,12 +30,12 @@ struct memblock_region {
|
||||
struct memblock_type {
|
||||
unsigned long cnt; /* number of regions */
|
||||
unsigned long max; /* size of the allocated array */
|
||||
phys_addr_t total_size; /* size of all regions */
|
||||
struct memblock_region *regions;
|
||||
};
|
||||
|
||||
struct memblock {
|
||||
phys_addr_t current_limit;
|
||||
phys_addr_t memory_size; /* Updated by memblock_analyze() */
|
||||
struct memblock_type memory;
|
||||
struct memblock_type reserved;
|
||||
};
|
||||
|
Reference in New Issue
Block a user