On Thu, Mar 23, 2023 at 12:54:42PM -0700, Yosry Ahmed wrote: > > > > At the time of swap out page into A, we will not know if it will > > move to B in a later time. I guess the swap ID xarray look up always > > needs to be there? > > If the indirection is enabled, yes. > > > > > > Moving a page from a swap backend A to another swap backend B should > > > not be a problem in terms of the swap cache, as we will add it to the > > > swap cache of B, modify the swap ID mapping to point to B, then remove > > > it from the swap cache of A. > > > > That means when B swap in a page, it will always look up the swap ID > > xarray first, then resolve to the actual swap_entry B1. > > Yes. There is an extra lookup. Ack. > > > > > > There are some concerns with this design that I outlined in one of my > > > previous emails, such as having separate swap counting implementation > > > in different swap backends, which is a maintenance burden and > > > error-prone. > > > > I agree that allocating the swap ID and maintaining the free swap ID > > would be some extra complexity if we are not reusing the existing swap > > count code path. > > > > My other concern would be the swap ID xarray indirection is always there > > regardless if you need to use the indirection or not. > > I think the idea is that this design is more minimal than the proposed > swap_desc, so we can have it behind a config option and remove the > indirection layer if it is not configured. > However, I am not yet sure if this would be straightforward. I need to > give this more thought. I have given it some thought. I am still concerned about this always on redirect layer in terms of memory usage and lookup overhead. Chris