From: Coiby Xu <coxu@redhat.com>
To: Milan Broz <gmazyland@gmail.com>
Cc: cryptsetup@lists.linux.dev
Subject: Re: How to estimate the upper bound of the peak memory consumption of cryptsetup itself?
Date: Mon, 20 Jun 2022 08:19:24 +0800 [thread overview]
Message-ID: <20220620001924.aymrih4ilzglgxpi@Rk> (raw)
In-Reply-To: <11d06783-c697-db7d-ed09-237d389aa07d@gmail.com>
On Sat, Jun 18, 2022 at 05:12:56PM +0200, Milan Broz wrote:
>On 16/06/2022 06:43, Coiby Xu wrote:
>>Hi,
>>
>>Recently, I notice cryptsetup itself consumes significant amount of
>>memory (~256M) when estimating the memory requirement for dumping vmcore
>>to a LUKS-encrypted disk,
>>
>>$ time -v cryptsetup luksOpen encrypted.img volume --key-file mykey.keyfile | grep "Maximum resident set size"
>> Maximum resident set size (kbytes): 1309828
>>$ cryptsetup luksDump encrypted.img
>>...
>>Keyslots:
>> 0: luks2
>> PBKDF: argon2id
>> Memory: 1048576
>> ...
>>
>>
>>So is there a way to estimate the upper bound of the peak memory
>>consumption of cryptsetup itself without running cryptsetup?
>
>As you already found, the major memory consumption is by memory-hard KDF.
>But this memory is used only while calculating keyslot encryption key,
>it is released immediately after the Argon call is finished.
>I do not think we have better estimation here.
Thanks for the reply! Sorry I meant the way to estimate the overhead of
crypsetup itself i.e. ~256M in the above example. Previously I only take
the memory consumption by memory-hard KDF into consideration and
neglected the memory consumption of cryptsetup itself. This obviously
leads to an underestimation of the memory requirement of cryptsetup. I
need to overestimate the memory requirement a bit to make sure OOM won't
happen that's why I am asking if there is a way to estimate the
upper bound of memory requirement of cryptsetup itself.
>
>(Another story is locking all memory, including big areas used by libc,
>but that should not be problem here, I hope.)
Do you mean locking all memory first in order to know the memory
requirement?
>
>Milan
>
--
Best regards,
Coiby
next prev parent reply other threads:[~2022-06-20 0:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 4:43 How to estimate the upper bound of the peak memory consumption of cryptsetup itself? Coiby Xu
2022-06-18 15:12 ` Milan Broz
2022-06-20 0:19 ` Coiby Xu [this message]
2022-06-24 9:14 ` Milan Broz
2022-06-24 10:49 ` Coiby Xu
2022-06-24 12:22 ` Milan Broz
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=20220620001924.aymrih4ilzglgxpi@Rk \
--to=coxu@redhat.com \
--cc=cryptsetup@lists.linux.dev \
--cc=gmazyland@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