Skip to content
Snippets Groups Projects
Select Git revision
13 results Searching

ebpf_jit.c

Blame
  • memblock.c 50.72 KiB
    /*
     * Procedures for maintaining information about logical memory blocks.
     *
     * Peter Bergner, IBM Corp.	June 2001.
     * Copyright (C) 2001 Peter Bergner.
     *
     *      This program is free software; you can redistribute it and/or
     *      modify it under the terms of the GNU General Public License
     *      as published by the Free Software Foundation; either version
     *      2 of the License, or (at your option) any later version.
     */
    
    #include <linux/kernel.h>
    #include <linux/slab.h>
    #include <linux/init.h>
    #include <linux/bitops.h>
    #include <linux/poison.h>
    #include <linux/pfn.h>
    #include <linux/debugfs.h>
    #include <linux/kmemleak.h>
    #include <linux/seq_file.h>
    #include <linux/memblock.h>
    #include <linux/bootmem.h>
    
    #include <asm/sections.h>
    #include <linux/io.h>
    
    #include "internal.h"
    
    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;
    #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 = {
    	.memory.regions		= memblock_memory_init_regions,
    	.memory.cnt		= 1,	/* empty dummy entry */
    	.memory.max		= INIT_MEMBLOCK_REGIONS,
    	.memory.name		= "memory",
    
    	.reserved.regions	= memblock_reserved_init_regions,
    	.reserved.cnt		= 1,	/* empty dummy entry */
    	.reserved.max		= INIT_MEMBLOCK_REGIONS,
    	.reserved.name		= "reserved",
    
    #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
    	.physmem.regions	= memblock_physmem_init_regions,
    	.physmem.cnt		= 1,	/* empty dummy entry */
    	.physmem.max		= INIT_PHYSMEM_REGIONS,
    	.physmem.name		= "physmem",
    #endif
    
    	.bottom_up		= false,
    	.current_limit		= MEMBLOCK_ALLOC_ANYWHERE,
    };
    
    int memblock_debug __initdata_memblock;
    static bool system_has_some_mirror __initdata_memblock = false;
    static int memblock_can_resize __initdata_memblock;
    static int memblock_memory_in_slab __initdata_memblock = 0;
    static int memblock_reserved_in_slab __initdata_memblock = 0;
    
    ulong __init_memblock choose_memblock_flags(void)
    {
    	return system_has_some_mirror ? MEMBLOCK_MIRROR : MEMBLOCK_NONE;
    }
    
    /* adjust *@size so that (@base + *@size) doesn't overflow, return new size */
    static inline phys_addr_t memblock_cap_size(phys_addr_t base, phys_addr_t *size)