All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Hui Zhu <teawater@gmail.com>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Hui Zhu <zhuhui@xiaomi.com>,
	ngupta@vflare.org, Hugh Dickins <hughd@google.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	acme@kernel.org, alexander.shishkin@linux.intel.com,
	Andrew Morton <akpm@linux-foundation.org>,
	mhocko@suse.com, hannes@cmpxchg.org, mgorman@techsingularity.net,
	vbabka@suse.cz, redkoi@virtuozzo.com, luto@kernel.org,
	kirill.shutemov@linux.intel.com, geliangtang@163.com,
	baiyaowei@cmss.chinamobile.com, dan.j.williams@intel.com,
	vdavydov@virtuozzo.com, aarcange@redhat.com, dvlasenk@redhat.com,
	jmarchan@redhat.com, koct9i@gmail.com, yang.shi@linaro.org,
	dave.hansen@linux.intel.com, vkuznets@redhat.com,
	vitalywool@gmail.com, ross.zwisler@linux.intel.com,
	Thomas Gleixner <tglx@linutronix.de>,
	kwapulinski.piotr@gmail.com, axboe@fb.com, mchristi@redhat.com,
	Joe Perches <joe@perches.com>,
	namit@vmware.com, Rik van Riel <riel@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [RFC 0/4] ZRAM: make it just store the high compression rate page
Date: Mon, 5 Sep 2016 12:59:08 +0900	[thread overview]
Message-ID: <20160905035908.GA552@swordfish> (raw)
In-Reply-To: <20160905021852.GB22701@bbox>

Hello,

On (09/05/16 11:18), Minchan Kim wrote:
[..]
> If I understand Sergey's point right, he means there is no gain
> to save memory between before and after.
> 
> With your approach, you can prevent unnecessary pageout(i.e.,
> uncompressible page swap out) but it doesn't mean you save the
> memory compared to old so why does your patch decrease the number of
> lowmemory killing?

you are right Minchan, that was exactly my point. every compressed page
that does not end up in huge_object zspage should result in some memory
saving (somewhere in the range from bytes to kilobytes).

> A thing I can imagine is without this feature, zram could be full of
> uncompressible pages so good-compressible page cannot be swapped out.

a good theory.

in general, a selective compression of N first pages that fall under the
given compression limit is not the same as a selective compression of N
"best" compressible pages. so I'm a bit uncertain about the guarantees
that the patch can provide.

let's assume the following case.
- zram compression size limit set to 2400 bytes (only pages smaller than
  that will be stored in zsmalloc)
- first K pages to swapout have compression size of 2350 +/- 10%
- next L pages have compression size of 2500 +/- 10%
- last M pages are un-compressible - PAGE_SIZE.
- zram disksize can fit N pages
- N > K + L

so instead of compressing and swapping out K + L pages, you would compress
only K pages, leaving (L + M) * PAGE_SIZE untouched. thus I'd say that we
might have bigger chances of LMK/OOM/etc. in some cases.

	-ss

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

WARNING: multiple messages have this Message-ID (diff)
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Hui Zhu <teawater@gmail.com>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Hui Zhu <zhuhui@xiaomi.com>,
	ngupta@vflare.org, Hugh Dickins <hughd@google.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	acme@kernel.org, alexander.shishkin@linux.intel.com,
	Andrew Morton <akpm@linux-foundation.org>,
	mhocko@suse.com, hannes@cmpxchg.org, mgorman@techsingularity.net,
	vbabka@suse.cz, redkoi@virtuozzo.com, luto@kernel.org,
	kirill.shutemov@linux.intel.com, geliangtang@163.com,
	baiyaowei@cmss.chinamobile.com, dan.j.williams@intel.com,
	vdavydov@virtuozzo.com, aarcange@redhat.com, dvlasenk@redhat.com,
	jmarchan@redhat.com, koct9i@gmail.com, yang.shi@linaro.org,
	dave.hansen@linux.intel.com, vkuznets@redhat.com,
	vitalywool@gmail.com, ross.zwisler@linux.intel.com,
	Thomas Gleixner <tglx@linutronix.de>,
	kwapulinski.piotr@gmail.com, axboe@fb.com, mchristi@redhat.com,
	Joe Perches <joe@perches.com>,
	namit@vmware.com, Rik van Riel <riel@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [RFC 0/4] ZRAM: make it just store the high compression rate page
Date: Mon, 5 Sep 2016 12:59:08 +0900	[thread overview]
Message-ID: <20160905035908.GA552@swordfish> (raw)
In-Reply-To: <20160905021852.GB22701@bbox>

Hello,

On (09/05/16 11:18), Minchan Kim wrote:
[..]
> If I understand Sergey's point right, he means there is no gain
> to save memory between before and after.
> 
> With your approach, you can prevent unnecessary pageout(i.e.,
> uncompressible page swap out) but it doesn't mean you save the
> memory compared to old so why does your patch decrease the number of
> lowmemory killing?

you are right Minchan, that was exactly my point. every compressed page
that does not end up in huge_object zspage should result in some memory
saving (somewhere in the range from bytes to kilobytes).

> A thing I can imagine is without this feature, zram could be full of
> uncompressible pages so good-compressible page cannot be swapped out.

a good theory.

in general, a selective compression of N first pages that fall under the
given compression limit is not the same as a selective compression of N
"best" compressible pages. so I'm a bit uncertain about the guarantees
that the patch can provide.

let's assume the following case.
- zram compression size limit set to 2400 bytes (only pages smaller than
  that will be stored in zsmalloc)
- first K pages to swapout have compression size of 2350 +/- 10%
- next L pages have compression size of 2500 +/- 10%
- last M pages are un-compressible - PAGE_SIZE.
- zram disksize can fit N pages
- N > K + L

so instead of compressing and swapping out K + L pages, you would compress
only K pages, leaving (L + M) * PAGE_SIZE untouched. thus I'd say that we
might have bigger chances of LMK/OOM/etc. in some cases.

	-ss

  reply	other threads:[~2016-09-05  3:58 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-22  8:25 [RFC 0/4] ZRAM: make it just store the high compression rate page Hui Zhu
2016-08-22  8:25 ` Hui Zhu
2016-08-22  8:25 ` [RFC 1/4] vmscan.c: shrink_page_list: unmap anon pages after pageout Hui Zhu
2016-08-22  8:25   ` Hui Zhu
2016-08-22  8:25 ` [RFC 2/4] Add non-swap page flag to mark a page will not swap Hui Zhu
2016-08-22  8:25   ` Hui Zhu
2016-09-06 15:35   ` Steven Rostedt
2016-09-06 15:35     ` Steven Rostedt
2016-08-22  8:25 ` [RFC 3/4] ZRAM: do not swap the page that compressed size bigger than non_swap Hui Zhu
2016-08-22  8:25   ` Hui Zhu
2016-08-22  8:25 ` [RFC 4/4] vmscan.c: zram: add non swap support for shmem file pages Hui Zhu
2016-08-22  8:25   ` Hui Zhu
2016-08-24  1:04 ` [RFC 0/4] ZRAM: make it just store the high compression rate page Minchan Kim
2016-08-24  1:04   ` Minchan Kim
2016-08-24  1:29   ` Hui Zhu
2016-08-24  1:29     ` Hui Zhu
2016-08-25  6:09 ` Sergey Senozhatsky
2016-08-25  6:09   ` Sergey Senozhatsky
2016-08-25  8:25   ` Hui Zhu
2016-08-25  8:25     ` Hui Zhu
2016-09-05  2:18     ` Minchan Kim
2016-09-05  2:18       ` Minchan Kim
2016-09-05  3:59       ` Sergey Senozhatsky [this message]
2016-09-05  3:59         ` Sergey Senozhatsky
2016-09-05  5:12       ` Hui Zhu
2016-09-05  5:12         ` Hui Zhu
2016-09-05  5:51         ` Minchan Kim
2016-09-05  5:51           ` Minchan Kim
2016-09-05  6:02           ` Hui Zhu
2016-09-05  6:02             ` Hui Zhu
2016-09-05  2:12 ` Minchan Kim
2016-09-05  2:12   ` 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=20160905035908.GA552@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=aarcange@redhat.com \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=axboe@fb.com \
    --cc=baiyaowei@cmss.chinamobile.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dvlasenk@redhat.com \
    --cc=geliangtang@163.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=jmarchan@redhat.com \
    --cc=joe@perches.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=koct9i@gmail.com \
    --cc=kwapulinski.piotr@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mchristi@redhat.com \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namit@vmware.com \
    --cc=ngupta@vflare.org \
    --cc=peterz@infradead.org \
    --cc=redkoi@virtuozzo.com \
    --cc=riel@redhat.com \
    --cc=ross.zwisler@linux.intel.com \
    --cc=rostedt@goodmis.org \
    --cc=teawater@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=vbabka@suse.cz \
    --cc=vdavydov@virtuozzo.com \
    --cc=vitalywool@gmail.com \
    --cc=vkuznets@redhat.com \
    --cc=yang.shi@linaro.org \
    --cc=zhuhui@xiaomi.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.