linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@suse.de>
To: Minchan Kim <minchan@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jens Axboe <axboe@kernel.dk>,
	Seth Jennings <sjenning@linux.vnet.ibm.com>,
	Nitin Gupta <ngupta@vflare.org>,
	Konrad Rzeszutek Wilk <konrad@darnok.org>,
	Luigi Semenzato <semenzato@google.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Pekka Enberg <penberg@cs.helsinki.fi>
Subject: Re: [PATCH v6 0/5] zram/zsmalloc promotion
Date: Wed, 14 Aug 2013 18:40:51 +0100	[thread overview]
Message-ID: <20130814174050.GN2296@suse.de> (raw)
In-Reply-To: <1376459736-7384-1-git-send-email-minchan@kernel.org>

On Wed, Aug 14, 2013 at 02:55:31PM +0900, Minchan Kim wrote:
> It's 6th trial of zram/zsmalloc promotion.
> [patch 5, zram: promote zram from staging] explains why we need zram.
> 
> Main reason to block promotion is there was no review of zsmalloc part
> while Jens already acked zram part.
> 
> At that time, zsmalloc was used for zram, zcache and zswap so everybody
> wanted to make it general and at last, Mel reviewed it.
> Most of review was related to zswap dumping mechanism which can pageout
> compressed page into swap in runtime and zswap gives up using zsmalloc
> and invented a new wheel, zbud. Other reviews were not major.
> http://lkml.indiana.edu/hypermail/linux/kernel/1304.1/04334.html
> 

zsmalloc has unpredictable performance characteristics when reclaiming
a single page when it was used to back zswap. I felt the unpredictable
performance characteristics would make it close to impossible to support
for normal server workloads. It would appear to work well until there were
massive stalls and I do not think this was ever properly investigated. At one
point I would have been happy if zsmalloc could be tuned to store only store
2 compressed pages  per physical page but cannot remember why that proposal
was never implemented (or if it was and I missed it or forgot). I expected
it would change over time but there were no follow-ups that I'm aware of.

I do not believe this is a problem for zram as such because I do not
think it ever writes back to disk and is immune from the unpredictable
performance characteristics problem. The problem for zram using zsmalloc
is OOM killing. If it's used for swap then there is no guarantee that
killing processes frees memory and that could result in an OOM storm.
Of course there is no guarantee that memory is freed with zbud either but
you are guaranteed that freeing 50%+1 of the compressed pages will free a
single physical page. The characteristics for zsmalloc are much more severe.
This might be managable in an applicance with very careful control of the
applications that are running but not for general servers or desktops.

If it's used for something like tmpfs then it becomes much worse. Normal
tmpfs without swap can lockup if tmpfs is allowed to fill memory. In a
sane configuration, lockups will be avoided and deleting a tmpfs file is
guaranteed to free memory. When zram is used to back tmpfs, there is no
guarantee that any memory is freed due to fragmentation of the compressed
pages. The only way to recover the memory may be to kill applications
holding tmpfs files open and then delete them which is fairly drastic
action in a normal server environment.

These are the sort of reason why I feel that zram has limited cases where
it is safe to use and zswap has a wider range of applications. At least
I would be very unhappy to try supporting zram in the field for normal
servers. zswap should be able to replace the functionality of zram+swap
by backing zswap with a pseudo block device that rejects all writes. I
do not know why this never happened but guess the zswap people never were
interested and the zram people never tried. Why was the pseudo device
to avoid writebacks never implemented? Why was the underlying allocator
not made pluggable to optionally use zsmalloc when the user did not care
that it had terrible writeback characteristics?

zswap cannot replicate zram+tmpfs but I also think that such a configuration
is a bad idea anyway. As zram is already being deployed then it might get
promoted anyway but personally I think compressed memory continues to be
a tragic story.

-- 
Mel Gorman
SUSE Labs

--
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:[~2013-08-14 17:41 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-14  5:55 Minchan Kim
2013-08-14  5:55 ` [PATCH v6 1/5] zsmalloc: add Kconfig for enabling page table method Minchan Kim
2013-08-14  5:55 ` [PATCH v6 2/5] zsmalloc: add more comment Minchan Kim
2013-08-14  5:55 ` [PATCH v6 3/5] zsmalloc: move it under zram Minchan Kim
2013-08-16 22:00   ` Seth Jennings
2013-08-20  4:21     ` Minchan Kim
2013-08-14  5:55 ` [PATCH v6 4/5] mm: export unmap_kernel_range Minchan Kim
2013-08-14  5:55 ` [PATCH v6 5/5] zram: promote zram from staging Minchan Kim
2013-08-14 15:53 ` [PATCH v6 0/5] zram/zsmalloc promotion Luigi Semenzato
2013-08-14 16:17   ` Minchan Kim
2013-08-15  0:18     ` Bob Liu
2013-08-15 15:03       ` Seth Jennings
2013-08-16  2:02     ` Wanpeng Li
2013-08-16  2:02     ` Wanpeng Li
     [not found]     ` <520d883a.a2f6420a.6f36.0d66SMTPIN_ADDED_BROKEN@mx.google.com>
2013-08-16  4:35       ` Minchan Kim
2013-08-16  7:02         ` Alex Elsayed
2013-08-14 17:40 ` Mel Gorman [this message]
2013-08-14 18:15   ` Luigi Semenzato
2013-08-14 18:58   ` Minchan Kim
2013-08-15 17:12     ` Mel Gorman
2013-08-16  1:52       ` Bob Liu
2013-08-16  1:53       ` Bob Liu
2013-08-16  4:26       ` Minchan Kim
2013-08-16  4:55         ` Bob Liu
2013-08-16  8:33         ` Mel Gorman
2013-08-16  9:12           ` Mel Gorman
2013-08-16  9:18             ` Bob Liu
2013-08-16 12:49               ` Greg Kroah-Hartman
2013-08-16  9:12           ` Bob Liu
2013-08-19  3:18           ` Minchan Kim
2013-08-19  3:57             ` Bob Liu
2013-08-19  4:37               ` Minchan Kim
2013-08-19  5:29                 ` Luigi Semenzato
2013-08-19  6:07                   ` Bob Liu
2013-08-19  6:11                   ` Minchan Kim
  -- strict thread matches above, loose matches on Subject: below --
2013-08-14  5:51 Minchan Kim

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=20130814174050.GN2296@suse.de \
    --to=mgorman@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=gregkh@linuxfoundation.org \
    --cc=konrad@darnok.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=semenzato@google.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