mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Mestnik <cheako@mikemestnik.net>
To: linux-kernel@vger.kernel.org
Subject: Tiered swap for zram.
Date: Wed, 25 Jan 2012 15:56:53 -0600	[thread overview]
Message-ID: <4F207AA5.2080309@mikemestnik.net> (raw)

zram is great, but it can fill up easily and when it does new/fresh
pages get pushed out to disk swap.  I've written a small bash script
that will flush zram swap to disk every five min.  However this is
better done with the VM subsystem and I suggest that swap mounts have a
tier as well as the current priority.

( while sleep 300; do for ech in /dev/zram?; do swapoff $ech& done; for
ech in /dev/zram?; do wait; done; for ech in /dev/zram?; do swapon -p 5
$ech& done; done; )& disown

The idea is that after a page has been in swap tier X for, say five min,
it will graduate to swap tier Y.  This keeps swap tier X free from any
long standing pages that are just taking up valuable realestate.

This script seams to do what I'm asking for, but at a heavy cost.



My second suggestion may take a while longer to implement.  It involves
adding a new bit-field to the record for each page.  This bitfield would
indicate the compression level/type of the contents of a page.  For
example zram would set the bit corresponding to the compresion it's
configured to use.

This would allow zram to refuse requests to swap pages that are already
compressed.  Thus further allow it to swap it's self.  When a swap mount
refuses a page this would be equivalent to that swap space being full
and the next swap mount would be used.

Future advancements of this bit-field may indicate the contents of
userspace pages, zram and others can mark a page as not vary well
compressible.  As such it's clear that this bit-field should be cleared
or marked dirty if the page is ever written to.

Thank you for a few moments of your time.  I hope that these could be
implemented.


             reply	other threads:[~2012-01-25 21:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-25 21:56 Mike Mestnik [this message]
2012-01-31  8:03 ` Mike Mestnik

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=4F207AA5.2080309@mikemestnik.net \
    --to=cheako@mikemestnik.net \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome