dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: San Mehat <san@google.com>
To: Milan Broz <mbroz@redhat.com>
Cc: Brian Swetland <swetland@google.com>,
	dm-devel@redhat.com, Andrew Morton <akpm@linux-foundation.org>,
	Alasdair G Kergon <agk@redhat.com>,
	Christophe Saout <christophe@saout.de>
Subject: Re: [PATCH] md: dm-crypt: Add option to re-use a new global work-queue.
Date: Tue, 27 Apr 2010 13:58:38 -0700	[thread overview]
Message-ID: <x2h236ccac1004271358o90a80b6bi1b4099865abc81e8@mail.gmail.com> (raw)
In-Reply-To: <s2p236ccac1004221242z4b0a8f68pbf7887e741a56af1@mail.gmail.com>

*ping* Any word on my previous counter-proposal? Shall I prepare
another patch for consideration?

-san


On Thu, Apr 22, 2010 at 12:42 PM, San Mehat <san@google.com> wrote:
> On Thu, Apr 22, 2010 at 11:47 AM, Milan Broz <mbroz@redhat.com> wrote:
>> On 04/22/2010 08:08 PM, San Mehat wrote:
>>> On Thu, Apr 22, 2010 at 11:03 AM, Milan Broz <mbroz@redhat.com> wrote:
>>>> On 04/22/2010 07:48 PM, San Mehat wrote:
>>>>> Typically, dm-crypt instances each have their own set of kcrypt/kcrypt_io
>>>>> work-queues. This patch adds an option which will create one set of
>>>>> work-queues on init, and re-uses them for all dm-crypt target instances.
>>
>>>> Can you explain the real reason for this patch?
>>>>
>>>
>>> Sure, I'd be happy to explain.
>>
>> (Please add this always to patch header.)
>>
>
> Will do - thanks.
>
>>>
>>>   Upcoming versions of android are about to start using dm/dm-crypt
>>> heavily, having
>>> a large number of small dm-crypt instances running on the device (hard
>>> to tell just
>>> how many, but i've seen cases where up to 50 or 60 instances may be
>>> running). This ends up creating 100 - 120 kernel threads, and I was
>>> simply trying to cut that down.
>>
>> Sorry, but I don't take this argument. "Too many notes!" :-)
>>
>> So the problem is with memory allocation? Scheduler? Or where?
>> Kernel threads should be cheap.
>>
>
> Well the initial consideration was towards memory overhead with so
> many threads that don't do much (in our use-case) on an embedded
> device.
>
>> If you need 60 crypt devices, you almost surely hit at least starvation
>> problem with one global queue!
>> (Just curious - what are these crypt devices doing?)
>
> The crypt devices are providing small read-only encrypted file-systems
> - whose backing files exist on an external FAT file-system, and are
> created on-demand as needed. In this usage scenario, we'll only see
> typically a few of these devices being simultaneously accessed, (and
> the sd-card throughput is definitely the long-pole in the performance
> profile, so even when I beat on 80 or 90 concurrent instances, we're
> mainly waiting for mmcqd to complete transactions).
>
>>
>>> I'd be more than happy to discuss alternatives; but do we *really*
>>> need 2 work-queue threads per instance?
>>
>> yes.
>
> What if we made a note in the Kconfig advising against using the option in
> stacked configurations? (Or even make it depend on CONFIG_EMBEDDED)
>
> Thanks for your time,
>
> -san
>
>>
>> For separate io queue - see commit cabf08e4d3d1181d7c408edae97fb4d1c31518af
>>
>> | Add post-processing queue (per crypt device) for read operations.
>>
>> | Current implementation uses only one queue for all operations
>> | and this can lead to starvation caused by many requests waiting
>> | for memory allocation. But the needed memory-releasing operation
>> | is queued after these requests (in the same queue).
>>
>>
>> (and there were another problem with async crypt - callback is called
>> in interrupt context, bio must be submitted from separate workqueue IIRC)
>>
>>>> (cc: Alasdair - I think he will not accept the patch anyway.)
>>>
>>> Probably not, but at least we can get the discussion going :)
>>
>> I am not saying that I do not want to discuss this - but we must know
>> the real problems many queues are causing first.
>> And then think about possible solutions.
>>
>> Milan
>>
>
>
>
> --
> San Mehat  |  Staff Software Engineer  |  Android  |  Google Inc.
> 415.366.6172 (san@google.com)
>



-- 
San Mehat  |  Staff Software Engineer  |  Android  |  Google Inc.
415.366.6172 (san@google.com)

  parent reply	other threads:[~2010-04-27 20:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 17:48 [PATCH] md: dm-crypt: Add option to re-use a new global work-queue San Mehat
2010-04-22 18:03 ` Milan Broz
2010-04-22 18:08   ` San Mehat
2010-04-22 18:47     ` Milan Broz
2010-04-22 19:42       ` San Mehat
2010-04-23 14:01         ` Heinz Mauelshagen
2010-04-27 20:58         ` San Mehat [this message]
2010-11-02 22:02           ` cmwq and dm-crypt devices? (was: Re: md: dm-crypt: Add option to re-use a new global work-queue.) Mike Snitzer
2010-11-03  9:46             ` cmwq and dm-crypt devices? Tejun Heo
2010-11-03 11:51               ` Andi Kleen
2010-11-03 11:56                 ` Milan Broz
2010-11-03 12:33                   ` Andi Kleen
2010-11-03 13:02                     ` Milan Broz
2010-11-03 13:18                     ` Alasdair G Kergon
2010-11-03 16:13                       ` Andi Kleen
2010-11-03 16:17                         ` Tejun Heo
2010-11-03 16:22                           ` Milan Broz
2010-11-04  9:55                             ` Andi Kleen

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=x2h236ccac1004271358o90a80b6bi1b4099865abc81e8@mail.gmail.com \
    --to=san@google.com \
    --cc=agk@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=christophe@saout.de \
    --cc=dm-devel@redhat.com \
    --cc=mbroz@redhat.com \
    --cc=swetland@google.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).