Re: [PATCH] powerpc/drmem: cache LMBs in xarray to accelerate lookup
From: Scott Cheloha
Date: Tue Feb 04 2020 - 11:19:17 EST
On Tue, Jan 28, 2020 at 05:56:55PM -0600, Nathan Lynch wrote:
> Scott Cheloha <cheloha@xxxxxxxxxxxxx> writes:
> > LMB lookup is currently an O(n) linear search. This scales poorly when
> > there are many LMBs.
> >
> > If we cache each LMB by both its base address and its DRC index
> > in an xarray we can cut lookups to O(log n), greatly accelerating
> > drmem initialization and memory hotplug.
> >
> > This patch introduces two xarrays of of LMBs and fills them during
> > drmem initialization. The patch also adds two interfaces for LMB
> > lookup.
>
> Good but can you replace the array of LMBs altogether
> (drmem_info->lmbs)? xarray allows iteration over the members if needed.
I would like to try to "solve one problem at a time".
We can fix the linear search performance scaling problems without
removing the array of LMBs. As I've shown in my diff, we can do it
with minimal change to the existing code.
If it turns out that the PAPR guarantees the ordering of the memory
DRCs then in a subsequent patch (series) we can replace the LMB array
(__drmem_info.lmbs) with an xarray indexed by DRC and use e.g.
xa_for_each() in the hotplug code.