linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Li, Weigang" <weigang.li@intel.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: <linux-crypto@vger.kernel.org>,
	"'Struk, Tadeusz'" <tadeusz.struk@intel.com>,
	'Sergey Senozhatsky' <sergey.senozhatsky.work@gmail.com>,
	<minchan@kernel.org>
Subject: Re: [PATCH] crypto: add asynchronous compression support
Date: Fri, 20 Nov 2015 15:25:00 +0800	[thread overview]
Message-ID: <564ECACC.7000004@intel.com> (raw)
In-Reply-To: <20151120061945.GA15262@gondor.apana.org.au>

On 11/20/2015 2:19 PM, Herbert Xu wrote:
> On Fri, Nov 20, 2015 at 03:04:47PM +0900, Joonsoo Kim wrote:
>>
>> Linearization would be enough to use sg-list but it has a problem.
>> Linearization needs sleepable function such as vmap() and it makes
>> sync (de)compression in atomic context impossible. Currently, zram
>> did sync (de)compression in atomic context. It uses map_vm_area() which
>> isn't sleepable function to linearize two separate pages. This is possible
>> because zram already knows that maximum number of spread pages is just two
>> and have allocated vm area in advance. But, if we implement linearization
>> in general API, we can't be sure of request input size so we need
>> sleepable function, vmap().
>>
>> And, this sleep could degrade performance.
>
> Obviously you would only perform linearisation where it's needed.
> And if you are in an atomic context, then clearly linearisation
> can only be attempted using kmalloc/alloc_pages with GFP_ATOMIC.
>
> I don't understand your concern with zram because either zram is
> already feeding us linear buffers in which case linearisation is
> never needed.  Or it can only be used with algorithms that support
> SG lists or partial updates, which we can easily mark using a flag.
>
>> Intermediate buffer size could vary greatly so it would be allocated and
>> Freed whenever requested. This could affect performance.
>
> That's for the crypto user to figure out.  Either they should
> supply a completely linear buffer if they want to be able to
> support every algorithm in an efficient manner, or they will
> either have to eat the cost of linearisation or only use algorithms
> that can deal with SG lists efficiently.
>
> We have the same problem with network drivers and it's dealt with
> in exactly the same way.  An skb can be an SG list and will be
> linearised when necessary.
>
>> I think that supporting unified API has more loss than gain.
>
> I disagree.  I have seen no valid reason so far for adding two
> compression interfaces.
>
> Cheers,
>
Thanks Herbert.

If we assume the sg-list can be linearized - no "holes" in the sg-list, 
all chunks in middle of the list are of PAGE_SIZE, it seems ok to 
support sg-list in the s/w implementation, linearize the sg-list and 
compress it as one chunk.

      reply	other threads:[~2015-11-20  7:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-16 15:11 [PATCH] crypto: add asynchronous compression support Weigang Li
2015-10-16 15:13 ` Herbert Xu
     [not found]   ` <929511EA6367314D8E32364A24D45FA612FE85D3@shsmsx102.ccr.corp.intel.com>
     [not found]     ` <000e01d10a12$9e381660$daa84320$@lge.com>
     [not found]       ` <20151019084905.GE963@bbox>
     [not found]         ` <20151021073322.GA31901@swordfish>
     [not found]           ` <20151021073418.GA14479@gondor.apana.org.au>
2015-10-21  7:59             ` Li, Weigang
2015-10-28 23:13               ` Dan Streetman
2015-11-06  1:55   ` Li, Weigang
2015-11-19  5:52   ` Li, Weigang
2015-11-19  9:42     ` Herbert Xu
2015-11-20  6:04       ` Joonsoo Kim
2015-11-20  6:19         ` Herbert Xu
2015-11-20  7:25           ` Li, Weigang [this message]

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=564ECACC.7000004@intel.com \
    --to=weigang.li@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=tadeusz.struk@intel.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;
as well as URLs for NNTP newsgroup(s).