Hi, On Tue, Sep 20, 2022 at 10:40:47AM +0200, Andrew Jones wrote: > On Tue, Aug 09, 2022 at 10:15:45AM +0100, Alexandru Elisei wrote: > > The page allocator has better allocation tracking and is used by all > > architectures, while the physical allocator is now never used for > > allocating memory. > > > > Simplify the physical allocator by removing allocation accounting. This > > accomplishes two things: > > > > 1. It makes the allocator more useful, as the warning that was displayed > > each allocation after the 256th is removed. > > > > 2. Together with the lock removal, the physical allocator becomes more > > appealing as a very early allocator, when using the page allocator might > > not be desirable or feasible. > > How does the locking cause problems when used in an early allocator? By "early allocator" I mean here an allocator that can be used with the MMU off. The "desirable or feasible" part refers to the fact that the page allocator cannot be used an early allocator (when the MMU is off) because 1. It doesn't do the necessary cache maintenance operations and 2. It would be hard to do add them, as the internal structures that the page allocator maintains are significantly more complex than what the physical allocator uses. With this part: "together with the lock removal, the physical allocator becomes more appealing as a very early allocator [..]" I was trying to say that the physical allocator has now become as simple as it can possibly be (well, align_min could also be removed and leave it up to the calling code to request correctly aligned allocations but it's debatable if users of the allocator should know about how it's implemented). I can reword or remove this part if you feel it's confusing. Thanks, Alex > > > > > Also, phys_alloc_show() has received a slight change in the way it displays > > the use and free regions: the end of the region is now non-inclusive, to > > allow phys_alloc_show() to express that no memory has been used, or no > > memory is free, in which case the start and the end adresses are equal. > > > > Signed-off-by: Alexandru Elisei <alexandru.elisei@xxxxxxx> > > --- > > lib/alloc_phys.c | 65 ++++++++++++++---------------------------------- > > lib/alloc_phys.h | 5 ++-- > > 2 files changed, 21 insertions(+), 49 deletions(-) > > > > Reviewed-by: Andrew Jones <andrew.jones@xxxxxxxxx>