mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 12:10:52 -04:00
s390/mm: Convert bootmem to memblock
The original bootmem allocator is getting replaced by memblock. To cover the needs of the s390 kdump implementation the physical memory list is used. With this patch the bootmem allocator and its bitmaps are completely removed from s390. Signed-off-by: Philipp Hachtmann <[email protected]> Signed-off-by: Martin Schwidefsky <[email protected]>
This commit is contained in:
parent
70210ed950
commit
50be634507
10 changed files with 270 additions and 498 deletions
|
|
@ -17,6 +17,8 @@
|
|||
#include <linux/miscdevice.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/memblock.h>
|
||||
|
||||
#include <asm/asm-offsets.h>
|
||||
#include <asm/ipl.h>
|
||||
#include <asm/sclp.h>
|
||||
|
|
@ -411,33 +413,24 @@ static ssize_t zcore_memmap_read(struct file *filp, char __user *buf,
|
|||
size_t count, loff_t *ppos)
|
||||
{
|
||||
return simple_read_from_buffer(buf, count, ppos, filp->private_data,
|
||||
MEMORY_CHUNKS * CHUNK_INFO_SIZE);
|
||||
memblock.memory.cnt * CHUNK_INFO_SIZE);
|
||||
}
|
||||
|
||||
static int zcore_memmap_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int i;
|
||||
struct memblock_region *reg;
|
||||
char *buf;
|
||||
struct mem_chunk *chunk_array;
|
||||
int i = 0;
|
||||
|
||||
chunk_array = kzalloc(MEMORY_CHUNKS * sizeof(struct mem_chunk),
|
||||
GFP_KERNEL);
|
||||
if (!chunk_array)
|
||||
return -ENOMEM;
|
||||
detect_memory_layout(chunk_array, 0);
|
||||
buf = kzalloc(MEMORY_CHUNKS * CHUNK_INFO_SIZE, GFP_KERNEL);
|
||||
buf = kzalloc(memblock.memory.cnt * CHUNK_INFO_SIZE, GFP_KERNEL);
|
||||
if (!buf) {
|
||||
kfree(chunk_array);
|
||||
return -ENOMEM;
|
||||
}
|
||||
for (i = 0; i < MEMORY_CHUNKS; i++) {
|
||||
sprintf(buf + (i * CHUNK_INFO_SIZE), "%016llx %016llx ",
|
||||
(unsigned long long) chunk_array[i].addr,
|
||||
(unsigned long long) chunk_array[i].size);
|
||||
if (chunk_array[i].size == 0)
|
||||
break;
|
||||
for_each_memblock(memory, reg) {
|
||||
sprintf(buf + (i++ * CHUNK_INFO_SIZE), "%016llx %016llx ",
|
||||
(unsigned long long) reg->base,
|
||||
(unsigned long long) reg->size);
|
||||
}
|
||||
kfree(chunk_array);
|
||||
filp->private_data = buf;
|
||||
return nonseekable_open(inode, filp);
|
||||
}
|
||||
|
|
@ -593,21 +586,12 @@ static int __init check_sdias(void)
|
|||
|
||||
static int __init get_mem_info(unsigned long *mem, unsigned long *end)
|
||||
{
|
||||
int i;
|
||||
struct mem_chunk *chunk_array;
|
||||
struct memblock_region *reg;
|
||||
|
||||
chunk_array = kzalloc(MEMORY_CHUNKS * sizeof(struct mem_chunk),
|
||||
GFP_KERNEL);
|
||||
if (!chunk_array)
|
||||
return -ENOMEM;
|
||||
detect_memory_layout(chunk_array, 0);
|
||||
for (i = 0; i < MEMORY_CHUNKS; i++) {
|
||||
if (chunk_array[i].size == 0)
|
||||
break;
|
||||
*mem += chunk_array[i].size;
|
||||
*end = max(*end, chunk_array[i].addr + chunk_array[i].size);
|
||||
for_each_memblock(memory, reg) {
|
||||
*mem += reg->size;
|
||||
*end = max_t(unsigned long, *end, reg->base + reg->size);
|
||||
}
|
||||
kfree(chunk_array);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue