All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Minchan Kim <minchan@kernel.org>
Subject: [PATCH v2 0/4] zram memory tracking
Date: Tue, 27 Mar 2018 15:50:29 +0900	[thread overview]
Message-ID: <20180327065033.181819-1-minchan@kernel.org> (raw)

zRam as swap is useful for small memory device. However, swap means
those pages on zram are mostly cold pages due to VM's LRU algorithm.
Especially, once init data for application are touched for launching,
they tend to be not accessed any more and finally swapped out.
zRAM can store such cold pages as compressed form but it's pointless
to keep in memory. As well, it's pointless to store incompressible
pages to zram so better idea is app developers manages them directly
like free or mlock rather than remaining them on heap.

This patch provides a debugfs /sys/kernel/debug/zram/zram0/block_state
to represent each block's state so admin can investigate what memory is
cold|incompressible|same page with using pagemap once the pages are
swapped out.

The output is as follows,

   25064    .wh       100
   25065    s..       9
   25067    ..h       15

First column is zram's block index and second one represents symbol
(s: same page w: written page to backing store h: huge page) of the 
block state. Last one means number of seconds elapsed since the block
was last accessed. So above example means the 25064th block is accessed
100 second ago and it was huge so it was written to the backing store.

* From v1:
  * Do not propagate error number for debugfs fail - Greg KH
  * Add writeback and hugepage information - Sergey

Minchan Kim (4):
  zram: correct flag name of ZRAM_ACCESS
  zram: mark incompressible page as ZRAM_HUGE
  zram: record accessed second
  zram: introduce zram memory tracking

 Documentation/blockdev/zram.txt |   1 +
 drivers/block/zram/Kconfig      |  10 ++
 drivers/block/zram/zram_drv.c   | 157 +++++++++++++++++++++++++++++---
 drivers/block/zram/zram_drv.h   |  12 ++-
 4 files changed, 163 insertions(+), 17 deletions(-)

-- 
2.17.0.rc0.231.g781580f067-goog

             reply	other threads:[~2018-03-27  6:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-27  6:50 Minchan Kim [this message]
2018-03-27  6:50 ` [PATCH v2 1/4] zram: correct flag name of ZRAM_ACCESS Minchan Kim
2018-03-27  6:50 ` [PATCH v2 2/4] zram: mark incompressible page as ZRAM_HUGE Minchan Kim
2018-03-27  6:50 ` [PATCH v2 3/4] zram: record accessed second Minchan Kim
2018-03-27  6:50 ` [PATCH v2 4/4] zram: introduce zram memory tracking Minchan Kim
2018-03-27  7:12   ` Greg KH
2018-03-27  7:23     ` Minchan Kim
2018-03-27  8:10   ` 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=20180327065033.181819-1-minchan@kernel.org \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergey.senozhatsky.work@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.