Re: A question about memblock.reserved

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 23, 2022 at 2:25 PM Chan Kim <ckim@xxxxxxxxxx> wrote:
>
> 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;
>
> 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,
> };
>
> 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).
>

Yes, reserved memblock is initialized while scanning the fdt.
I'll attach some call graph below and I hope it helps you.

setup_arch ()
  arm64_memblock_init ()
    early_init_fdt_scan_reserved_mem ()
      fdt_init_reserved_mem ()
        fdt_scan_reserved_mem ()
          __reserved_mem_reserve_reg ()
            early_init_dt_reserve_memory_arch ()
              memblock_reserve ()

Plus, I written some *scribbled* notes about this in Korean.
I don't know if it will help, but I will attach it below.

https://kjhg4321.gitbook.io/doodle/

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux