Hi Luca, On 09/04/2024 13:45, Luca Fancellu wrote: > > > Currently the memory footprint of the static shared memory feature > is impacting all the struct meminfo instances with memory space > that is not going to be used. > > To solve this issue, rework the static shared memory extra > information linked to the memory bank to another structure, > struct shmem_membank_extra, and exploit the struct membank > padding to host a pointer to that structure in a union with the > enum membank_type, with this trick the 'struct membank' has the > same size with or without the static shared memory, given that > the 'type' and 'shmem_extra' are never used at the same time, > hence the 'struct membank' won't grow in size. > > Afterwards, create a new structure 'struct shared_meminfo' which > has the same interface of 'struct meminfo', but requires less I would expect some justification for selecting 32 as the max number of shmem banks
> banks and hosts the extra information for the static shared memory. > The fields 'bank' and 'extra' of this structure are meant to be > linked by the index (e.g. extra[idx] will have the information for > the bank[idx], for i=0..NR_SHMEM_BANKS), the convinient pointer > 'shmem_extra' of 'struct membank' is then linked to the related > 'extra' bank to ease the fruition when a function has access only > to the 'struct membanks common' of 'struct shared_meminfo'. > > The last part of this work is to move the allocation of the > static shared memory banks from the 'reserved_mem' to a new > 'shmem' member of the 'struct bootinfo'. > Change also the 'shm_mem' member type to be 'struct shared_meminfo' > in order to match the above changes and allow a memory space > reduction also in 'struct kernel_info'. > > Signed-off-by: Luca Fancellu <luca.fance...@arm.com> With the find_unallocated_memory() issue fixed: Reviewed-by: Michal Orzel <michal.or...@amd.com> ~Michal