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

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

 



On Fri, Mar 17, 2023 at 11:19 AM Chris Li <chrisl@xxxxxxxxxx> wrote:
>
> On Fri, Mar 17, 2023 at 03:19:09AM -0700, Yosry Ahmed wrote:
> > > Now, we will not drop the swap cache even if the swap count becomes 0 if
> > > swap space utility < 50%.  Per my understanding, this avoid swap page
> > > writing for read accesses.  So I don't think we can change this directly
> > > without necessary discussion firstly.
> >
> >
> > Right. I am not sure I understand why we do this today, is it to save
> > the overhead of allocating a new swap entry if the page is swapped out
> > again soon? I am not sure I understand this statement "this avoid swap
> > page
> > writing for read accesses".
>
> When the page is swapped out again soon. If the swap slot has been recycled,
> then the page need to assign to a new swap slot, most likely different than
> the previous slot. Then the page write out would need to write that page
> to the swap device, even though that swap device might already has the
> same page data in the previous slot.
>
> If keeping the previous swap slot cache when swap space utility < 50%,
> then the swap code can avoid writing out to the same slot with the same
> data, if the page is not dirty (read only access).
>
> The saving is in 1) avoid allocating a new slot. 2) For read access,
> avoid page io write the same data to the same slot.

I see. Makes sense. Thanks, Chris.

I guess in this case we shouldn't just unconditionally free the swap
entry once the page is swapped in without giving it some thought.

>
> 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