All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonsoo Kim <iamjoonsoo.kim@lge.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Li, Weigang" <weigang.li@intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Minchan Kim <minchan@kernel.org>,
	Dan Streetman <ddstreet@ieee.org>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 04/10] crypto/compress: add asynchronous compression support
Date: Thu, 28 Jan 2016 12:19:42 +0900	[thread overview]
Message-ID: <20160128031941.GA14467@js1304-P5Q-DELUXE> (raw)
In-Reply-To: <20160127080926.GA31516@gondor.apana.org.au>

Hello, Herbert.

On Wed, Jan 27, 2016 at 04:09:26PM +0800, Herbert Xu wrote:
> On Wed, Jan 27, 2016 at 04:03:55PM +0800, Herbert Xu wrote:
> > On Wed, Jan 27, 2016 at 03:59:05PM +0800, Li, Weigang wrote:
> > >
> > > The acomp is also SG-based, while scomp only accepts flat buffer.
> > 
> > Right, but do we need a pointer-based scomp at all? IPComp would
> > certainly be better off with an SG-based interface.  Any other
> > users of compression are presumably dealing with large amounts
> > of data where an SG interface would make more sense.
> > 
> > A pointer interface makes sense for shash because you may be hashing
> > 16 bytes at a time.  Nobody sane is going to be compressing 16 bytes,
> > or are they?

Hmm... I'm not an expert on this area so below of my analysis would be
wrong.

Some of compression example in kernel do compression with PAGE_SIZE and
compressed size is naturally less than PAGE_SIZE. There are many cases
that compressed size is below than 100 bytes. To keep and handle data,
they somtimes use kmalloced buffer and I guess it isn't suitable for
SG-based interface. Is it okay to use SG-based interface
if kmalloced object covers two pages?

And, even, someone uses vmalloced buffer that's also not suitable for
SG-based interface. For large amount data case, vmalloced buffer is
more suitable and it needs pointer interface.

> Note that I'm fine with keeping an scomp interface underneath
> for those algorithms where the best way to handle SG input is
> to linearise things.  But I would prefer that this interface is
> not exposed to kernel users unless it is absolutely required.

I have tested asynchronous compression APIs in zram and I saw
regression. Atomic allocation and setting up SG lists are culprit
for this regression. Moreover, zram optimizes linearisation
to get the best performance so it has two Kconfig options. One of
them cannot be support in the general layer. Not supporting pointer
based APIs unavoidably causes regression to zram in this case.

And, S/W compression algorithms that exists in kernel
are pointer based so it's natural to support it first
in crypto compression. That will help existing users to change
their direct library call to crypto compression without any regression.
They may be happy to change it because they just could get more
algorithm support without any loss.

I think that supporting pointer-based interface has some merits
mentioned above. However, I'm not sure what's the benefit if we only
support SG-based interface and it's bigger than above.

Thanks.

  parent reply	other threads:[~2016-01-28  3:50 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-26  8:15 [PATCH v2 00/10] Introduce new async/sync compression APIs Joonsoo Kim
2016-01-26  8:15 ` [PATCH v2 01/10] crypto/compress: remove unused pcomp interface Joonsoo Kim
2016-01-27 14:17   ` Herbert Xu
2016-01-26  8:15 ` [PATCH v2 02/10] crypto: add algorithm type specific flag, CRYPTO_ALG_PRIVATE Joonsoo Kim
2016-01-26  8:15 ` [PATCH v2 03/10] crypto/compress: introduce sychronuous compression API Joonsoo Kim
2016-01-26  8:15 ` [PATCH v2 04/10] crypto/compress: add asynchronous compression support Joonsoo Kim
2016-01-27  7:41   ` Herbert Xu
2016-01-27  7:59     ` Li, Weigang
2016-01-27  8:03       ` Herbert Xu
2016-01-27  8:09         ` Herbert Xu
2016-01-27  8:26           ` Li, Weigang
2016-01-28  3:19           ` Joonsoo Kim [this message]
2016-01-29 10:09             ` Herbert Xu
2016-02-01  2:11               ` Joonsoo Kim
2016-02-04  3:25                 ` Li, Weigang
2016-02-04  3:28                   ` Herbert Xu
2016-02-04  3:29                     ` Herbert Xu
2016-02-04  3:50                       ` Li, Weigang
2016-02-04 14:56                         ` Herbert Xu
2016-02-04  7:17                     ` Joonsoo Kim
2016-02-04 14:53                       ` Herbert Xu
2016-02-04 16:19                         ` Joonsoo Kim
2016-01-26  8:15 ` [PATCH v2 05/10] crypto/lzo: support new compression APIs Joonsoo Kim
2016-01-26  8:15 ` [PATCH v2 06/10] crypto/lz4: " Joonsoo Kim
2016-01-26  8:15 ` [PATCH v2 07/10] crypto/lz4hc: " Joonsoo Kim
2016-01-26  8:15 ` [PATCH v2 08/10] crypto/842: " Joonsoo Kim
2016-01-26  8:15 ` [PATCH v2 09/10] crypto/deflate: " Joonsoo Kim
2016-01-26  8:15 ` [PATCH v2 10/10] crypto/testmgr: add new compression APIs test Joonsoo Kim

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=20160128031941.GA14467@js1304-P5Q-DELUXE \
    --to=iamjoonsoo.kim@lge.com \
    --cc=davem@davemloft.net \
    --cc=ddstreet@ieee.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=weigang.li@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.