All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonsoo Kim <js1304@gmail.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	linux-kernel@vger.kernel.org, kernel-team@lge.com
Subject: Re: [PATCH v4 2/4] zram: implement deduplication in zram
Date: Tue, 2 May 2017 14:31:20 +0900	[thread overview]
Message-ID: <20170502053118.GB27335@js1304-desktop> (raw)
In-Reply-To: <20170427074622.GA428@jagdpanzerIV.localdomain>

On Thu, Apr 27, 2017 at 04:46:22PM +0900, Sergey Senozhatsky wrote:
> Hello,
> 
> On (04/27/17 15:57), Joonsoo Kim wrote:
> [..]
> > I tested with your benchmark and found that contention happens
> > since the data page is perfectly the same. All the written data (2GB)
> > is de-duplicated.
> 
> yes, a statically filled buffer to guarantee that
> compression/decompression numbers/impact will be stable.
> otherwise the test results are "apples vs oranges" :)

Yes, but, we can maintain buffer set and using it on the test will
ensure "apples vs apples" test and will be less aftificial test.
Compression algorithm's effect also cannot be measured by a statically
filled buffer.

> 
> > I tried to optimize it with read-write lock but I failed since
> > there is another contention, which cannot be fixed simply. That is
> > zsmalloc. We need to map the object and compare the content of the
> > compressed page to check de-duplication. Zsmalloc pins the object
> > by using bit spinlock when mapping. So, parallel readers to the same
> > object contend here.
> >
> > I think that this case is so artificial and, in practice, there
> > would be no case that the same data page is repeatedly and parallel
> > written as like this. So, I'd like to keep current code. How do you
> > think about it, Sergey?
> 
> I agree. thanks for taking a look!
> I see no blockers for the patch set.

Thanks!

> 
> 
> <off topic>
> 
> ok, in general, seems that (correct me if I'm wrong)
> 
>   a) the higher the dedup ratio the slower zram _can_ perform.
> 
> because dedup can create parallel access scenarios where they previously
> never existed: different offset writes now can compete for the same dedupped
> zsmalloc object.

However, the higher the dedup ratio doesn't necessarily mean that all
the data is the same. Important thing is the distribution of the data
rather than dedup ratio. And, parallelism is also important.

> and... tricky and probably over exaggerated
> 
>   b) the lower the dedup ratio the slower zram _can_ perform.
> 
> think of almost full zram device with dedup ratio of just 3-5%. tree lookups
> are serialized by the hash->lock. a balanced tree gives us slow lookup
> complexity growth, it's still there but can leave with it. at the same time
> low dedup ratio means that we have wasted CPU cycles on checksum calculation
> (potentially for millions of pages if zram device in question is X gigabytes
> in size), this can't go unnoticed.
> 
> 
> it's just I was slightly confused by the performance numbers that you
> have observed. some tests were
> 
> : It shows performance degradation roughly 13% and save 24% memory. Maybe,
> : it is due to overhead of calculating checksum and comparison.
> 
> while others were
> 
> : There is no performance degradation and save 23% memory.

As I said above, dedup ratio itself doesn't say everything. And, they are
quite different tests (kernel build vs file copy) (multi thread vs
single thread) so I cannot say anything by the fact that their saving
ratio is similar. :)

> 
> I understand that you didn't perform direct io, flush, fsync, etc. and
> there is a whole bunch of factors that could have affected your tests,
> e.g. write back, etc. etc. but the numbers are still very unstable.
> may be now we will have a bit better understanding :)

I also hope so.

Thanks.

  reply	other threads:[~2017-05-02  5:31 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26  0:52 [PATCH v4 0/4] zram: implement deduplication in zram js1304
2017-04-26  0:52 ` [PATCH v4 1/4] zram: introduce zram_entry to prepare dedup functionality js1304
2017-04-26  0:52 ` [PATCH v4 2/4] zram: implement deduplication in zram js1304
2017-04-26  2:14   ` Sergey Senozhatsky
2017-04-26  5:57     ` Joonsoo Kim
2017-04-26  6:29       ` Minchan Kim
2017-04-26  6:59         ` Joonsoo Kim
2017-04-26  7:21           ` Sergey Senozhatsky
2017-04-26  7:39             ` Minchan Kim
2017-04-26  7:12         ` Sergey Senozhatsky
2017-04-26  2:37   ` Sergey Senozhatsky
2017-04-26  5:59     ` Joonsoo Kim
2017-04-26  6:04       ` Sergey Senozhatsky
2017-04-26  4:02   ` Sergey Senozhatsky
2017-04-26  6:04     ` Joonsoo Kim
2017-04-26  6:21       ` Sergey Senozhatsky
2017-04-27  6:57         ` Joonsoo Kim
2017-04-27  7:46           ` Sergey Senozhatsky
2017-05-02  5:31             ` Joonsoo Kim [this message]
2017-04-26  4:28   ` Sergey Senozhatsky
2017-04-26  6:08     ` Joonsoo Kim
2017-04-26  6:14       ` Sergey Senozhatsky
2017-04-26  0:52 ` [PATCH v4 3/4] zram: make deduplication feature optional js1304
2017-04-26  0:52 ` [PATCH v4 4/4] zram: compare all the entries with same checksum for deduplication js1304
2017-04-27  7:49 ` [PATCH v4 0/4] zram: implement deduplication in zram Sergey Senozhatsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170502053118.GB27335@js1304-desktop \
    --to=js1304@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=kernel-team@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.