Re: [PATCH v2 1/3] mm/memblock: implement memblock_advise_size_order and probe functions
From: Gregory Price
Date: Mon Oct 21 2024 - 10:40:12 EST
On Sun, Oct 20, 2024 at 11:57:27AM +0300, Mike Rapoport wrote:
> On Wed, Oct 16, 2024 at 03:24:43PM -0400, Gregory Price wrote:
> > Hotplug memory sources may have opinions on what the memblock size
> > should be - usually for alignment purposes. For example, CXL memory
> > extents can be as small as 256MB with a matching physical alignment.
> >
> > Implement memblock_advise_size_order for use during early init, prior
> > to allocator and smp init, for software to advise the system as to what
> > the preferred block size should be.
> >
> > The probe function is meant for arch_init code to fetch this value
> > once during memblock size calculation. Use of the advisement value
> > is arch-specific, and no guarantee is made that it will be used.
>
> I'm confused.
>
> Aren't we talking about memory blocks for hotplugable memory here?
> This functionality rather belongs to drivers/base/memory.c, doesn't it?
>
You're right, I should have put it there - i got distracted by the ifdef
mess around get_block_size_bytes/set...order and just tossed it into memblock
to avoid it. I should be able to ifdef the definition in the header and move
it into memory.c
> > Calls to either function after probe results in -EBUSY to signal that
> > advisement is ignored or that memblock_get_size_bytes should be used.
> >
> > Suggested-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> > Signed-off-by: Gregory Price <gourry@xxxxxxxxxx>
> > ---
> > include/linux/memblock.h | 2 ++
> > mm/memblock.c | 49 ++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 51 insertions(+)
> >