public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/8] zram: use crypto api to check alg availability
Date: Wed, 1 Jun 2016 12:17:35 +0900	[thread overview]
Message-ID: <20160601025236.GG461@swordfish> (raw)
In-Reply-To: <20160601022708.GL19976@bbox>

On (06/01/16 11:27), Minchan Kim wrote:
[..]
> > > So, if we do 'cat /sys/block/zram0/comp_algorithm", every crypto modules
> > > in the backend array are loaded in memory and not unloaded until admin
> > > executes rmmod? Right?
> > 
> > yes, I think so.
> 
> It scares me. Common case, except one we choosed, every loaded modules
> will be not used. I think it's really not good. Although the wastage
> might be not big now, it will be heavy as crypto comp modules are
> increased.

well... if you have those modules enabled then you somehow expect
them to be loaded at some point, if not by zram, then by something
else (networking, etc.). /* not speaking of the systems that have
those modules built-in */ I'm not saying that what we have is
optimal, of course, but it's not so senseless at the same time.


> What do you think about it?

I can do something like this:

diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index 1a4bd20..9b704cc 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -20,10 +20,18 @@
 
 static const char * const backends[] = {
        "lzo",
+#if IS_ENABLED(CONFIG_CRYPTO_LZ4)
        "lz4",
+#endif
+#if IS_ENABLED(CONFIG_CRYPTO_DEFLATE)
        "deflate",
+#endif
+#if IS_ENABLED(CONFIG_CRYPTO_LZ4HC)
        "lz4hc",
+#endif
+#if IS_ENABLED(CONFIG_CRYPTO_842)
        "842",
+#endif
        NULL
 };


so both BUILTIN and BUILT-AS-A-MODULE cases are handled at compile
time now and we can avoid crypto_has_comp() checks for most of the
comp_algorithm calls, except for the case when someone requests an
out-of-tree module.

	-ss

  reply	other threads:[~2016-06-01  3:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31 12:20 [PATCH v2 0/8] zram: switch to crypto api Sergey Senozhatsky
2016-05-31 12:20 ` [PATCH v2 1/8] zram: rename zstrm find-release functions Sergey Senozhatsky
2016-05-31 12:20 ` [PATCH v2 2/8] zram: switch to crypto compress API Sergey Senozhatsky
2016-05-31 23:40   ` Minchan Kim
2016-05-31 23:44   ` Minchan Kim
2016-06-01  1:17     ` Sergey Senozhatsky
2016-05-31 12:20 ` [PATCH v2 3/8] zram: align zcomp interface to crypto comp API Sergey Senozhatsky
2016-05-31 23:48   ` Minchan Kim
2016-06-01  1:13     ` Sergey Senozhatsky
2016-05-31 12:20 ` [PATCH v2 4/8] zram: use crypto api to check alg availability Sergey Senozhatsky
2016-06-01  0:03   ` Minchan Kim
2016-06-01  1:07     ` Sergey Senozhatsky
2016-06-01  2:27       ` Minchan Kim
2016-06-01  3:17         ` Sergey Senozhatsky [this message]
2016-06-01  6:47           ` Minchan Kim
2016-06-01  7:48             ` Sergey Senozhatsky
2016-06-01 14:59               ` Austin S. Hemmelgarn
2016-06-02  2:40               ` Minchan Kim
2016-05-31 12:20 ` [PATCH v2 5/8] zram: cosmetic: cleanup documentation Sergey Senozhatsky
2016-06-01  0:06   ` Minchan Kim
2016-05-31 12:20 ` [PATCH v2 6/8] zram: delete custom lzo/lz4 Sergey Senozhatsky
2016-06-01  0:08   ` Minchan Kim
2016-05-31 12:20 ` [PATCH v2 7/8] zram: add more compression algorithms Sergey Senozhatsky
2016-06-01  0:24   ` Minchan Kim
2016-05-31 12:20 ` [PATCH v2 8/8] zram: drop gfp_t from zcomp_strm_alloc() Sergey Senozhatsky
2016-06-01  0:41   ` Minchan Kim
2016-05-31 12:29 ` [PATCH v2 0/8] zram: switch to crypto api Sergey Senozhatsky
2016-05-31 19:07   ` Andrew Morton
2016-06-01  0:58     ` 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=20160601025236.GG461@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=sergey.senozhatsky@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox