Re: [External] Re: [bug report] mm/zswap :memory corruption after zswap_load().

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

 



[..]
>
> > This is only a problem when we skip the swapcache during swapin.
> > Otherwise the swapcache synchronizes this. I wonder how much does
> > skipping the swapcache buy us on recent kernels? This optimization was
> > introduced a long time ago.
>
> Still performs quite good. according to kairui's data:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=13ddaf26be324a7f951891ecd9ccd04466d27458
>
> Before: 10934698 us
> After: 11157121 us
> Cached: 13155355 us (Dropping SWP_SYNCHRONOUS_IO flag)

That's 17.9% slower if we use the swapcache. Commit 0bcac06f27d7 ("mm,
swap: skip swapcache for swapin of synchronous device") says:
"""
This patch aims to reduce swap-in latency by skipping swapcache if the
swap device is synchronous device like rw_page based device.  It
enhances 45% my swapin test(5G sequential swapin, no readahead, from
2.41sec to 1.64sec).
"""

So went from 45% to 17.9%, we are getting close :)

>
> BTW, zram+zswap seems pointless from the first beginning. it seems a wrong
> configuration for users.  if this case is really happening, could we
> simply fix it

Yeah we can do that. Zhongkun said they have a use case for zram+zswap
tho, but I don't know what it is.

If we can find a better (yet still simple) fix, then I would prefer
that. Otherwise enforcing the use of the swapcache when zswap is
enabled sounds like a viable option.

> by:
>
> diff --git a/mm/memory.c b/mm/memory.c
> index b7cab8be8632..6742d1428373 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3999,7 +3999,7 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
>         swapcache = folio;
>
>         if (!folio) {
> -               if (data_race(si->flags & SWP_SYNCHRONOUS_IO) &&
> +               if (!is_zswap_enabled() && data_race(si->flags &
> SWP_SYNCHRONOUS_IO) &&
>                     __swap_count(entry) == 1) {
>                         /*
>                          * Prevent parallel swapin from proceeding with




[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