A question about memblock.reserved

Chan Kim ckim at etri.re.kr
Thu Jun 23 01:25:22 EDT 2022


Hello all,

I mm/memblock.c I see this struct memblock memblock which is initialized
with empty list.

	static struct memblock_region
memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
	static struct memblock_region
memblock_reserved_init_regions[INIT_MEMBLOCK_RESERVED_REGIONS]
__initdata_memblock;
	#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
	static struct memblock_region
memblock_physmem_init_regions[INIT_PHYSMEM_REGIONS];
	#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_RESERVED_REGIONS,
	    .reserved.name      = "reserved",

	    .bottom_up      = false,
	    .current_limit      = MEMBLOCK_ALLOC_ANYWHERE,
	};

And I guess this struct will be filled during early boot and used during
boot. (I saw somewhere the memory regions are later moved to buddy
allocation system for normal use).
My question is : we can speicify "reserved-memory" in the device tree. Some
drivers use the reserved memory for its own use.
Then, are the 'reserved-memory' regions are put into this memblock.reserved
regions during the boot process?(I mean during dtb parsing).

Thank you!

Chan Kim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20220623/98bcf98f/attachment.html>


More information about the Kernelnewbies mailing list