public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	<linux-kernel@vger.kernel.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: Re: [PATCH v3 3/7] zram: use crypto api to check alg availability
Date: Tue, 7 Jun 2016 15:14:50 +0900	[thread overview]
Message-ID: <20160607061450.GA13528@bbox> (raw)
In-Reply-To: <20160604024902.11778-4-sergey.senozhatsky@gmail.com>

On Sat, Jun 04, 2016 at 11:48:58AM +0900, Sergey Senozhatsky wrote:
> There is no way to get a string with all the crypto comp
> algorithms supported by the crypto comp engine, so we need
> to maintain our own backends list. At the same time we
> additionally need to use crypto_has_comp() to make sure
> that the user has requested a compression algorithm that is
> recognized by the crypto comp engine. Relying on /proc/crypto
> is not an options here, because it does not show not-yet-inserted
> compression modules.
> 
> Example:
> 
>  modprobe zram
>  cat /proc/crypto | grep -i lz4
>  modprobe lz4
>  cat /proc/crypto | grep -i lz4
> name         : lz4
> driver       : lz4-generic
> module       : lz4
> 
> So the user can't tell exactly if the lz4 is really supported
> from /proc/crypto output, unless someone or something has loaded
> it.
> 
> This patch also adds crypto_has_comp() to zcomp_available_show().
> We store all the compression algorithms names in zcomp's `backends'
> array, regardless the CONFIG_CRYPTO_FOO configuration, but show
> only those that are also supported by crypto engine. This helps
> user to know the exact list of compression algorithms that can be
> used.
> 
> Example:
>   module lz4 is not loaded yet, but is supported by the crypto
>   engine. /proc/crypto has no information on this module, while
>   zram's `comp_algorithm' lists it:
> 
>  cat /proc/crypto | grep -i lz4
> 
>  cat /sys/block/zram0/comp_algorithm
> [lzo] lz4 deflate lz4hc 842
> 
> We still use the `backends' array to determine if the requested
> compression backend is known to crypto api. This array, however,
> may not contain some entries, therefore as the last step we call
> crypto_has_comp() function which attempts to insmod the requested
> compression algorithm to determine if crypto api supports it. The
> advantage of this method is that now we permit the usage of
> out-of-tree crypto compression modules (implementing S/W or H/W
> compression).
> 
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>

  reply	other threads:[~2016-06-07  6:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-04  2:48 [PATCH v3 0/7] zram: switch to crypto api Sergey Senozhatsky
2016-06-04  2:48 ` [PATCH v3 1/7] zram: rename zstrm find-release functions Sergey Senozhatsky
2016-06-04  2:48 ` [PATCH v3 2/7] zram: switch to crypto compress API Sergey Senozhatsky
2016-06-04  2:48 ` [PATCH v3 3/7] zram: use crypto api to check alg availability Sergey Senozhatsky
2016-06-07  6:14   ` Minchan Kim [this message]
2016-06-04  2:48 ` [PATCH v3 4/7] zram: cosmetic: cleanup documentation Sergey Senozhatsky
2016-06-04  2:49 ` [PATCH v3 5/7] zram: delete custom lzo/lz4 Sergey Senozhatsky
2016-06-04  2:49 ` [PATCH v3 6/7] zram: add more compression algorithms Sergey Senozhatsky
2016-06-07  6:22   ` Minchan Kim
2016-06-04  2:49 ` [PATCH v3 7/7] zram: drop gfp_t from zcomp_strm_alloc() 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=20160607061450.GA13528@bbox \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --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