Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1464550

Re: [PATCH 3/4] zswap: Zero-filled pages handling

From Pekka Enberg <penberg@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 3/4] zswap: Zero-filled pages handling
Date 2016-08-17 14:30 +0200
Message-ID <s788O-XT-7@gated-at.bofh.it> (permalink)
References <s7670-84T-17@gated-at.bofh.it> <s7670-84T-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Aug 17, 2016 at 1:18 PM, Srividya Desireddy
<srividya.dr@samsung.com> wrote:
> This patch adds a check in zswap_frontswap_store() to identify zero-filled
> page before compression of the page. If the page is a zero-filled page, set
> zswap_entry.zeroflag and skip the compression of the page and alloction
> of memory in zpool. In zswap_frontswap_load(), check if the zeroflag is
> set for the page in zswap_entry. If the flag is set, memset the page with
> zero. This saves the decompression time during load.
>
> The overall overhead caused due to zero-filled page check is very minimal
> when compared to the time saved by avoiding compression and allocation in
> case of zero-filled pages. The load time of a zero-filled page is reduced
> by 80% when compared to baseline.

AFAICT, that's an overall improvement only if there are a lot of
zero-filled pages because it's just overhead for pages that we *need*
to compress, no? So I suppose the question is, are there a lot of
zero-filled pages that we need to swap and why is that the case?

> @@ -1314,6 +1347,13 @@ static int zswap_frontswap_load(unsigned type, pgoff_t offset,
>         }
>         spin_unlock(&tree->lock);
>
> +       if (entry->zeroflag) {
> +               dst = kmap_atomic(page);
> +               memset(dst, 0, PAGE_SIZE);
> +               kunmap_atomic(dst);
> +               goto freeentry;
> +       }

Don't we need the same thing in zswap_writeback_entry() for the
ZSWAP_SWAPCACHE_NEW case?

> +
>         /* decompress */
>         dlen = PAGE_SIZE;
>         src = (u8 *)zpool_map_handle(entry->pool->zpool, entry->zhandle->handle,
> @@ -1327,6 +1367,7 @@ static int zswap_frontswap_load(unsigned type, pgoff_t offset,
>         zpool_unmap_handle(entry->pool->zpool, entry->zhandle->handle);
>         BUG_ON(ret);

- Pekka

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3/4] zswap: Zero-filled pages handling Srividya Desireddy <srividya.dr@samsung.com> - 2016-08-17 12:20 +0200
  Re: [PATCH 3/4] zswap: Zero-filled pages handling Pekka Enberg <penberg@kernel.org> - 2016-08-17 14:30 +0200
    Re: [PATCH 3/4] zswap: Zero-filled pages handling Pekka Enberg <penberg@kernel.org> - 2016-08-17 14:40 +0200

csiph-web