linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Bob Liu <bob.liu@oracle.com>
To: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: Bob Liu <lliubbo@gmail.com>,
	linux-mm@kvack.org, akpm@linux-foundation.org, ngupta@vflare.org,
	minchan@kernel.org, konrad.wilk@oracle.com,
	dan.magenheimer@oracle.com, rcj@linux.vnet.ibm.com,
	mgorman@suse.de, riel@redhat.com, dave@sr71.net,
	hughd@google.com
Subject: Re: [RFC PATCH] zswap: add zswap shrinker
Date: Wed, 22 May 2013 12:03:03 +0800	[thread overview]
Message-ID: <519C4377.8020206@oracle.com> (raw)
In-Reply-To: <20130521185720.GA3398@medulla>


On 05/22/2013 02:57 AM, Seth Jennings wrote:
> On Tue, May 21, 2013 at 02:26:07PM +0800, Bob Liu wrote:
>> In my understanding, currenlty zswap have a few problems.
>> 1. The zswap pool size is 20% of total memory that's too random and once it
>> gets full the performance may even worse because everytime pageout() an anon
>> page two disk-io write ops may happend instead of one.
> 
> Just to clarify, 20% is a default maximum amount that zswap can occupy.
> 
> Also, in the steady over-the-limit state, the average number of writebacks is
> equal to the number of pages coming into zswap.  The description above makes it
> sound like there is a reclaim amplification effect (two writebacks per zswap
> store) when, on average, there is none. The 2:1 effect only happens on one or
> two store operations right after the pool becomes full.

I don't think it only happens on one or two store operations.

When the system enter a situation or run a workload which have many anon
pages, the zswap pool will be full easily and most of the time.

But after it's full there are still many anon pages need to be reclaimed
and frontswap_store() will be entered and call zbud_reclaim_page() to
writeout two pages every time.

The effect to the user will be after the zswap is full, the disk IO is
always twice than disable it.

> 
> This is unclear though, mostly because the pool limit is enforced in
> zswap.  A situation exists where there might be an unbuddied zbud page with
> room for the upcoming allocation but, because we are over the pool limit,
> reclaim is done during that store anyway. I'm working on a clean way to fix

Yes, but always reclaim by writing out two pages.
So after the pool is full, there will be always more disk IO than normal
which can cause performance drop and make the user surprise.

> that up, probably by moving the limit enforcement into zbud as suggested by
> Mel.

Nice :)

> 
>> 2. The reclaim hook will only be triggered in frontswap_store().
>> It may be result that the zswap pool size can't be adjusted in time which may
>> caused 20% memory lose for other users.
>>
>> This patch introduce a zswap shrinker, it make the balance that the zswap
>> pool size will be the same as anon pages in use.
> 
> Using zbud, with 2 zpages per zbud page, that would mean that up to 2/3 of anon
> pages could be compressed while 1/3 remain uncompressed.
> 
> How did you conclude that this is the right balance?
> 

It may not, but at least it can be changed dynamically for different
workloads. It can be higher than 20%*total_mem if there are too many
anon pages and can be shrinked easily.

> If nr_reclaim in the shrinker became very large due to global_anon_pages_inuse
> suddenly dropping, we could be writing back a LOT of pages all at once.
> 

Hmm, that's a problem.

> Having already looked at the patch, I can say that this isn't going to be the
> way to do this.  I agree that there should be some sort of dynamic sizing, but

Yes, that's what I'm looking forward to see. A policy to manage/balance
the size of zswap pool dynamically.
Maybe you have better idea to implement it.

> IMHO using a shrinker isn't the way.  Dave Chinner would not be happy about
> this since it is based on the zcache shrinker logic and he didn't have many
> kind words to say about it: https://lkml.org/lkml/2012/11/27/552
> 
> Seth
> 

Thanks!

-- 
Regards,
-Bob

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

  reply	other threads:[~2013-05-22  4:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-21  6:26 [RFC PATCH] zswap: add zswap shrinker Bob Liu
2013-05-21 18:57 ` Seth Jennings
2013-05-22  4:03   ` Bob Liu [this message]
2013-05-22  6:05     ` Bob Liu
2013-05-22 14:08     ` Seth Jennings
2013-05-23  1:56       ` Bob Liu

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=519C4377.8020206@oracle.com \
    --to=bob.liu@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.magenheimer@oracle.com \
    --cc=dave@sr71.net \
    --cc=hughd@google.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=lliubbo@gmail.com \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=rcj@linux.vnet.ibm.com \
    --cc=riel@redhat.com \
    --cc=sjenning@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).