All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Milan Broz <gmazyland@gmail.com>, Itai Handler <itai.handler@gmail.com>
Cc: dm-devel@redhat.com, Mikulas Patocka <mpatocka@redhat.com>,
	agk@redhat.com
Subject: Re: [dm-devel] [RFC PATCH 1/1] dm crypt: change maximum sector size to PAGE_SIZE
Date: Fri, 12 Nov 2021 10:32:56 -0500	[thread overview]
Message-ID: <YY6JKAYDl8lHE6BB@redhat.com> (raw)
In-Reply-To: <da6989dc-1fab-cbd0-4ea9-1b60ea9de964@gmail.com>

On Thu, Nov 11 2021 at  8:07P -0500,
Milan Broz <gmazyland@gmail.com> wrote:

> On 10/11/2021 18:43, Itai Handler wrote:
> > Maximum sector size of dm-crypt is currently limited to 4096 bytes.
> > 
> > On systems where PAGE_SIZE is larger than 4096 bytes, using larger
> > sectors can be beneficial for performance reasons.
> 
> The limit to 4096 was set because this is the smallest possible
> page size that all platform supports.
> 
> If you allow a higher size here, the device cannot be activated on a platform
> with the smaller page size. (Encrypted sector size becomes
> atomic sector size for all upper layers - as you mention below, not
> all fs support bigger sectors.)
> 
> For LUKS, this is not acceptable - the format is portable by definition.
> 
> For specific dm-crypt device, I am not sure. I would better kept
> the 4096 page size limit here.
> 
> It also depends on crypto API driver here (performance is usually optimized to 4k).
> What cipher and encryption mode did you use for test?
> 
> How the number looks for random access? Linear test is usually misleading.
> I expect there will be big performance problem if you write small data chunks,
> writes and encryption will be amplified to full big sectors here...)
> 
> (Technical detail: such patch MUST increase dm-crypt minor version.)
> 
> Milan

Thanks for your insight Milan, much appreciated.

> > 
> > This patch changes maximum sector size from 4096 bytes to PAGE_SIZE,
> > and in addition it changes the type of sector_size in
> > struct crypt_config from 'unsigned short int' to 'unsigned int', in
> > order to be able to represent larger values.
> > 
> > On a prototype system which has PAGE_SIZE of 65536 bytes, I saw about
> > x2 performance improvement in sequential read throughput benchmark
> > while using only about half of the CPU usage, after simply increasing
> > sector size from 4096 to 65536 bytes.
> > I used ext4 filesystem for that benchmark, which supports 64KiB
> > sectors.
> > 
> > Note: A small change should be made in cryptsetup in order to add
> > support for sectors larger than 4096 bytes.
> > 
> > Signed-off-by: Itai Handler <itai.handler@gmail.com>

Your patch is way too raw.  It doesn't come with any understanding of
all the nuanced reasons for 4096 that Milan raised above, and so I've
dropped your patch from further consideration.

Mike

--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


  reply	other threads:[~2021-11-12 15:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-10 17:43 [dm-devel] [RFC PATCH 1/1] dm crypt: change maximum sector size to PAGE_SIZE Itai Handler
2021-11-11 13:07 ` Milan Broz
2021-11-12 15:32   ` Mike Snitzer [this message]
2021-11-14 11:56   ` Itai Handler
2021-11-25 16:28     ` Itai Handler
2021-11-27 11:19       ` Milan Broz
2021-11-28 15:33         ` Itai Handler
2022-03-13 14:53           ` Itai Handler

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=YY6JKAYDl8lHE6BB@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=gmazyland@gmail.com \
    --cc=itai.handler@gmail.com \
    --cc=mpatocka@redhat.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.