Re: [LSF/MM/BPF TOPIC] Swap Abstraction / Native Zswap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 23, 2023 at 08:56:43AM +0800, Huang, Ying wrote:
> > We need to carefully design the swap cache that, when moving between
> > swap implementaions, there will be one shared swap cache. The current
> > swap cache belongs to swap devices, so two devices will have the same
> > page in two swap caches.
> 
> We can remove a page from the swap cache for the swap device A, then
> insert the page into the swap cache for the swap device B.  The swap
> entry will be changed too.
It is possible, however very tricky.

Let's assume the swap entry in device A has more than one user.
e.g. Swap entry A1 on device A is shared by three different
process. It is installed in three PTE locations. When A1 page data
write to device B, gain a new swap entry B1.

We will need to walk the three process page table to hunt down
PTE point to the swap entry A1, change that to B1. There will
be a short time window some processes have B1 and other processes
havee A1.  If both of them trigger page fault to swap in the
page. You will have the same page in both A and B's swap cache.
It needs to be back by the same physical page.

That seems to suggest that it needs to merge the swap cache look
up somehow.

> >> We can allocate a swap entry for each swapped page in zswap.
> >
> > One thing to consider when moving page from zswap to swap file, is the
> > zswap swap entry the same entry as the swap file entry.
> 
> I think that the swap entry will be changed after moving.  Swap entry is
> kind of local to a swap device.  While the swap desc ID isn't changed,
> that is why we need the indirection layer.

Due to the above mentioned  complication. I am also evaluating
a design have the zswap just share the same swap entry as the
underlying swap device.

The price to pay is one extra look up in zswap. That is similar
to the current frontswap.


Chris





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux