Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751920AbbFBUmb (ORCPT ); Tue, 2 Jun 2015 16:42:31 -0400 Received: from mail-qc0-f175.google.com ([209.85.216.175]:35997 "EHLO mail-qc0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751176AbbFBUmY (ORCPT ); Tue, 2 Jun 2015 16:42:24 -0400 MIME-Version: 1.0 In-Reply-To: <20150602201118.GA14741@cerebellum.local.variantweb.net> References: <1433257917-13090-1-git-send-email-ddstreet@ieee.org> <1433257917-13090-4-git-send-email-ddstreet@ieee.org> <20150602201118.GA14741@cerebellum.local.variantweb.net> From: Dan Streetman Date: Tue, 2 Jun 2015 16:42:03 -0400 X-Google-Sender-Auth: F9om69W8NkQUt7mJNvoBaWRjciU Message-ID: Subject: Re: [PATCH 3/5] zswap: runtime enable/disable To: Seth Jennings Cc: Andrew Morton , Linux-MM , linux-kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2477 Lines: 74 On Tue, Jun 2, 2015 at 4:11 PM, Seth Jennings wrote: > On Tue, Jun 02, 2015 at 11:11:55AM -0400, Dan Streetman wrote: >> 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. > > I like this one. So much so I wrote it about 2 years ago :) > > http://lkml.iu.edu/hypermail/linux/kernel/1307.2/04289.html > > It didn't go in though and I forgot about it. > > We need to update the documentation too (see my patch). ok sure, forgot about the docs. I'll resend just this patch, with doc updates, so we can split things up as you suggested. > > Thanks, > Seth > >> >> Signed-off-by: Dan Streetman >> --- >> 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 >> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/