All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Luigi Semenzato <semenzato@google.com>, linux-mm@kvack.org
Subject: Re: mm performance with zram
Date: Tue, 13 Jan 2015 10:18:19 +0100	[thread overview]
Message-ID: <54B4E2DB.90004@suse.cz> (raw)
In-Reply-To: <CAA25o9Sf62u3mJtBp_swLL0RS2Zb=EjZtWERJqyrbBpk7-bP-A@mail.gmail.com>

On 01/08/2015 11:49 PM, Luigi Semenzato wrote:
> I am taking a closer look at the performance of the Linux MM in the
> context of heavy zram usage.  The bottom line is that there is
> surprisingly high overhead (35-40%) from MM code other than
> compression/decompression routines.  I'd like to share some results in
> the hope they will be helpful in planning future development.
> 
> SETUP
> 
> I am running on an ASUS Chromebox with about 2GB RAM (actually 4GB,
> but with mem=1931M).  The zram block device size is approx. 2.8GB
> (uncompressed size).
> 
> http://www.amazon.com/Asus-CHROMEBOX-M004U-ASUS-Desktop/dp/B00IT1WJZQ
> 
> Intel(R) Celeron(R) 2955U @ 1.40GHz
> MemTotal:        1930456 kB
> SwapTotal:       2827816 kB
> 
> I took the kernel from Linus's tree a few days ago: Linux localhost
> 3.19.0-rc2+ (...) x86_64.  I also set maxcpus=1.  The kernel
> configuration is available if needed.
> 
> EXPERIMENTS
> 
> I wrote a page walker (historically called "balloon") which allocates
> a lot of memory, more than physical RAM, and fills it with a dump of
> /dev/mem from a Chrome OS system running at capacity.  The memory
> compresses down to about 35%.  I ran two main experiments.
> 
> 1. Compression/decompression.  After filling the memory, the program
> touches the first byte of all pages in a random permutation (I tried
> sequentially too, it makes little difference).  At steady state, this
> forces one page decompression and one compression (on average) at each
> step of the walk.
> 
> 2. Decompression only.  After filling the memory, the program walks
> all pages sequentially.  Then it frees the second half of the pages
> (the ones most recently touched), and walks the first half.  This
> causes one page decompression at each step, and almost no
> compressions.
> 
> RESULTS
> 
> The average time (real time) to walk a page in microseconds is
> 
> experiment 1 (compress + decompress): 26.5  us/page
> experiment 2 (decompress only): 9.3 us/page
> 
> I ran "perf record -ag"during the relevant parts of the experiment.
> (CAVEAT: the version of perf I used doesn't match the kernel, it's
> quite a bit older, but that should be mostly OK).  I put the output of
> "perf report" in this Google Drive folder:
> 
> https://drive.google.com/folderview?id=0B6kmZ3mOd0bzVzJKeTV6eExfeFE&usp=sharing
> 
> (You shouldn't need a Google ID to access it.  You may have to re-join
> the link if the plain text mailer splits it into multiple lines.)
> 
> I also tried to analyze cumulative graph profiles.  Interestingly the
> only tool I found to do this is gprof2dot (any other suggestion?  I

I think this could be useful for better graphs here:

http://www.brendangregg.com/flamegraphs.html

> would prefer a text-based tool).  The output is in the .png files in
> the same folder.  The interesting numbers are:
> 
> experiment 1
> compression 43.2%
> decompression 20.4%
> everything else 36.4%
> 
> experiment 2
> decompression 61.7%
> everything else 38.3%
> 
> The graph profiles don't seem to show low-hanging fruits on any path.
> 
> CONCLUSION
> 
> Before zram, in a situation involving swapping, the MM overhead was
> probably nearly invisible, especially with rotating disks.  But with
> zram the MM is surprisingly close to being the main bottleneck.
> Compression/decompression speeds will likely improve, and they are
> tuneable (tradeoff between compression ratio and speed).  Compression
> can happen often in the background, so decompression speed is more
> important for latency, and LZ4 decompression can already be a lot
> faster than LZO (the experiments use LZO, and LZ4 can be 2x faster).
> This suggests that simplifying and speeding up the relevant code paths
> in the Linux MM may be worth the effort.
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2015-01-13  9:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-08 22:49 mm performance with zram Luigi Semenzato
2015-01-09  6:30 ` Andrew Morton
2015-01-09 16:45   ` Luigi Semenzato
2015-01-10  0:06     ` Joonsoo Kim
2015-01-10  0:19       ` Luigi Semenzato
2015-01-10  0:42         ` Joonsoo Kim
2015-01-13  9:18 ` Vlastimil Babka [this message]
2015-01-13 16:25   ` Luigi Semenzato

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=54B4E2DB.90004@suse.cz \
    --to=vbabka@suse.cz \
    --cc=linux-mm@kvack.org \
    --cc=semenzato@google.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.