Re: [PATCH v2] memblock: add no-map alloc functions

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

 



On Fri, Apr 19, 2024 at 10:59:52AM +0900, DaeRo Lee wrote:
> 2024년 4월 19일 (금) 오전 10:46, DaeRo Lee <skseofh@xxxxxxxxx>님이 작성:
> >
> > In memmap_init_reserved_pages, we mark memblock.reserved as
> > PageReserved first and mark the memblock.reserved with nomap flag
> > also.
> Sorry. This is my mistake. 'memblock.memory with nomap flag' is right.
> 
> > -> Isn't this duplicated work? (If we add no-map region to
> > memblock.reserved 'and' mark in memblock.memory..)
> > So, I think that for the no-map region, we don't need to add to the
> > memblock.reserved.
> > This is what we do now in early_init_dt_reserve_memory. the nomap
> > region is not added to the memblock.reserved.
> >
> > In early_init_dt_alloc_reserved_memory_arch, if 'nomap' is true, we
> > mark the memblock.memory region as _NOMAP. And if the return value
> > 'err' is not zero(which is '-ENOMEM' from memblock_isolate_range), we
> > free the region.
> > - 'nomap' is true -> memblock_mark_nomap : success -> not free the region
> >
> > : fail -> free the region
> > And it can be said that we add the region to the memblock.reserved
> > using memblock_phys_alloc_range and if the region is nomap, then we
> > can free the region from memblock.reserved. But is it necessary to add
> > it to memblock.reserved? We just need the region in memblock.memory to
> > mark nomap.
> >
> > So, here is what I think:
> > - reserved-memory w/ nomap region -> mark only to memblock.memory
> > - reserved-memory w/o nomap region -> add to the memblock.reserved

NOMAP and memblock.reserved are semantically different, and at makes sense
to have a "reserved nomap" node in fdt recorded in both memblock.memory and
memblock.reserved.

memblock.reserved represents the memory that is used by firmware or early
kernel allocation, so reserved memory in fdt should be reserved in memblock
as well. I believe it's an oversight that early_init_dt_reserve_memory()
does not call memblock_reserve() for nomap memory.

NOMAP is a property of a memory region that says that that region should
not be mapped in the linear map, it's not necessarily in use.

> > Regards,
> > DaeRo Lee

-- 
Sincerely yours,
Mike.




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux