On Tue, Mar 28, 2023 at 02:01:09PM -0700, Yosry Ahmed wrote: > On Tue, Mar 28, 2023 at 1:50 PM Chris Li <chrisl@xxxxxxxxxx> wrote: > > > > On Tue, Mar 28, 2023 at 12:59:31AM -0700, Yosry Ahmed wrote: > > > > > I don't have a problem with this approach, it is not really clean as > > > > > we still treat zswap as a swapfile and have to deal with a lot of > > > > > unnecessary code like swap slots handling and whatnot. > > > > > > > > These are existing code? > > > > Yes. The ghost swap file are existing code used in Google for many years. > > > > > I was referring to the fact that today with zswap being tied to > > > swapfiles we do some necessary work such as searching for swap slots > > > during swapout. The initial swap_desc approach aimed to avoid that. > > > With this minimal ghost swapfile approach we retain this unfavorable > > > behavior. > > > > Can you explain how you can avoid the free swap entry search > > in the swap descriptor world? > > For zswap, in the swap descriptor world, you just need to allocate a > struct zswap_entry and have the swap descriptor point to it. No need > for swap slot management since we are not tied to a swapfile and pages > in zswap do not have a specific position. Your swap descriptor will be using one swp_entry_t, which get from the PTE to lookup, right? That is the swap entry I am talking about. You just substitute zswap swap entry with the swap descriptor swap entry. You still need to allocate from the free swap entry space at least once. Chris