[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200129181013.lz6q5lpntnhwclqi@rascal.austin.ibm.com>
Date: Wed, 29 Jan 2020 12:10:13 -0600
From: Scott Cheloha <cheloha@...ux.ibm.com>
To: Nathan Lynch <nathanl@...ux.ibm.com>
Cc: Nathan Fontenont <ndfont@...il.com>,
Rick Lindsley <ricklind@...ux.vnet.ibm.com>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
Michael Ellerman <mpe@...erman.id.au>
Subject: Re: [PATCH] powerpc/drmem: cache LMBs in xarray to accelerate lookup
On Tue, Jan 28, 2020 at 05:56:55PM -0600, Nathan Lynch wrote:
> Scott Cheloha <cheloha@...ux.ibm.com> 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 don't think we can without potentially changing the current behavior.
The current behavior in dlpar_memory_{add,remove}_by_ic() is to advance
linearly through the array from the LMB with the matching DRC index.
Iteration through the xarray via xa_for_each_start() will return LMBs
indexed with monotonically increasing DRC indices.
Are they equivalent? Or can we have an LMB with a smaller DRC index
appear at a greater offset in the array?
If the following condition is possible:
drmem_info->lmbs[i].drc_index > drmem_info->lmbs[j].drc_index
where i < j, then we have a possible behavior change because
xa_for_each_start() may not return a contiguous array slice. It might
"leap backwards" in the array. Or it might skip over a chunk of LMBs.
Powered by blists - more mailing lists