From: Dan Streetman <ddstreet@ieee.org>
To: Seth Jennings <sjennings@variantweb.net>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Dan Streetman <ddstreet@ieee.org>
Subject: [PATCH 3/5] zswap: runtime enable/disable
Date: Tue, 2 Jun 2015 11:11:55 -0400 [thread overview]
Message-ID: <1433257917-13090-4-git-send-email-ddstreet@ieee.org> (raw)
In-Reply-To: <1433257917-13090-1-git-send-email-ddstreet@ieee.org>
Change the "enabled" parameter to be configurable at runtime. Remove
the enabled check from init(), and move it to the frontswap store()
function; when enabled, pages will be stored, and when disabled, pages
won't be stored.
Signed-off-by: Dan Streetman <ddstreet@ieee.org>
---
mm/zswap.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/mm/zswap.c b/mm/zswap.c
index 4249e82..e070b10 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -75,9 +75,10 @@ static u64 zswap_duplicate_entry;
/*********************************
* tunables
**********************************/
-/* Enable/disable zswap (disabled by default, fixed at boot for now) */
-static bool zswap_enabled __read_mostly;
-module_param_named(enabled, zswap_enabled, bool, 0444);
+
+/* Enable/disable zswap (disabled by default) */
+static bool zswap_enabled;
+module_param_named(enabled, zswap_enabled, bool, 0644);
/* Compressor to be used by zswap (fixed at boot for now) */
#define ZSWAP_COMPRESSOR_DEFAULT "lzo"
@@ -648,6 +649,9 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset,
u8 *src, *dst;
struct zswap_header *zhdr;
+ if (!zswap_enabled)
+ return -EPERM;
+
if (!tree) {
ret = -ENODEV;
goto reject;
@@ -901,9 +905,6 @@ static int __init init_zswap(void)
{
gfp_t gfp = __GFP_NORETRY | __GFP_NOWARN;
- if (!zswap_enabled)
- return 0;
-
pr_info("loading zswap\n");
zswap_pool = zpool_create_pool(zswap_zpool_type, "zswap", gfp,
--
2.1.0
next prev parent reply other threads:[~2015-06-02 15:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 15:11 [PATCH 0/5] zswap: make params runtime changeable Dan Streetman
2015-06-02 15:11 ` [PATCH 1/5] zpool: add zpool_has_pool() Dan Streetman
2015-06-02 15:11 ` [PATCH 2/5] module: add per-module params lock Dan Streetman
2015-06-02 15:11 ` Dan Streetman [this message]
2015-06-02 20:11 ` [PATCH 3/5] zswap: runtime enable/disable Seth Jennings
2015-06-02 20:42 ` Dan Streetman
2015-06-02 15:11 ` [PATCH 4/5] zswap: dynamic pool creation Dan Streetman
2015-06-02 15:11 ` [PATCH 5/5] zswap: change zpool/compressor at runtime Dan Streetman
2015-06-02 20:26 ` [PATCH 0/5] zswap: make params runtime changeable Seth Jennings
2015-06-02 20:47 ` Dan Streetman
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=1433257917-13090-4-git-send-email-ddstreet@ieee.org \
--to=ddstreet@ieee.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sjennings@variantweb.net \
/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).