mm/memblock: expose only miminal interface to add/walk physmem
"physmem" in the memblock allocator is somewhat weird: it's not actually used for allocation, it's simply information collected during boot, which describes the unmodified physical memory map at boot time, without any standby/hotplugged memory. It's only used on s390 and is currently the only reason s390 keeps using CONFIG_ARCH_KEEP_MEMBLOCK. Physmem isn't numa aware and current users don't specify any flags. Let's hide it from the user, exposing only for_each_physmem(), and simplify. The interface for physmem is now really minimalistic: - memblock_physmem_add() to add ranges - for_each_physmem() / __next_physmem_range() to walk physmem ranges Don't place it into an __init section and don't discard it without CONFIG_ARCH_KEEP_MEMBLOCK. As we're reusing __next_mem_range(), remove the __meminit notifier to avoid section mismatch warnings once CONFIG_ARCH_KEEP_MEMBLOCK is no longer used with CONFIG_HAVE_MEMBLOCK_PHYS_MAP. While fixing up the documentation, sneak in some related cleanups. We can stop setting CONFIG_ARCH_KEEP_MEMBLOCK for s390 next. Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: Mike Rapoport <rppt@linux.ibm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Hildenbrand <david@redhat.com> Reviewed-by: Mike Rapoport <rppt@linux.ibm.com> Message-Id: <20200701141830.18749-2-david@redhat.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:

committed by
Heiko Carstens

parent
a303e88743
commit
7764990581
@@ -549,8 +549,7 @@ static int get_mem_chunk_cnt(void)
|
||||
int cnt = 0;
|
||||
u64 idx;
|
||||
|
||||
for_each_mem_range(idx, &memblock.physmem, &oldmem_type, NUMA_NO_NODE,
|
||||
MEMBLOCK_NONE, NULL, NULL, NULL)
|
||||
for_each_physmem_range(idx, &oldmem_type, NULL, NULL)
|
||||
cnt++;
|
||||
return cnt;
|
||||
}
|
||||
@@ -563,8 +562,7 @@ static void loads_init(Elf64_Phdr *phdr, u64 loads_offset)
|
||||
phys_addr_t start, end;
|
||||
u64 idx;
|
||||
|
||||
for_each_mem_range(idx, &memblock.physmem, &oldmem_type, NUMA_NO_NODE,
|
||||
MEMBLOCK_NONE, &start, &end, NULL) {
|
||||
for_each_physmem_range(idx, &oldmem_type, &start, &end) {
|
||||
phdr->p_filesz = end - start;
|
||||
phdr->p_type = PT_LOAD;
|
||||
phdr->p_offset = start;
|
||||
|
Reference in New Issue
Block a user