public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Corry <kevcorry@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@osdl.org>, Alasdair G Kergon <agk@redhat.com>
Subject: Re: [PATCH] 2/5: Device-mapper: kcopyd
Date: Thu, 10 Jun 2004 08:16:18 +0000	[thread overview]
Message-ID: <200406100816.18263.kevcorry@us.ibm.com> (raw)
In-Reply-To: <20040609231805.029672aa.akpm@osdl.org>

On Thursday 10 June 2004 6:18 am, Andrew Morton wrote:
> Alasdair G Kergon <agk@redhat.com> wrote:
> > kcopyd
> >
> > ...
> > +/* FIXME: this should scale with the number of pages */
> > +#define MIN_JOBS 512
>
> This pins at least 2MB of RAM up-front, even if devicemapper is not in use.

Is that really the case? The MIN_JOBS value is used to initialize the mempool 
of kcopyd_job structures (see kcopyd.c::jobs_init()). A kcopyd_job is 
(according to my calculations on i386) 272 bytes. If you assume they are 
nicely aligned, then we'll round that up to 512 bytes. This means you should 
be able to fit 8 of those structures in a page, and initializing to MIN_JOBS 
should only use 256kB of RAM. Granted, 256kB of RAM isn't all the great 
either, but it's about an order of magnitude less than 2MB.

Or am I not understanding how kmem_caches and mempools work?

The jobs_init() routine is run (and hence the kmem_cache and mempool are 
created) when kcopyd() is loaded, so the min-value has to be set to some 
static number. One possibility to cut down on the up-front memory usage would 
be to reduce the static MIN_JOBS value, and then use mempool_resize() when 
the kcopyd users call kcopyd_client_[create|destroy].

Another thing we could do would be to build kcopyd as its own kernel module. 
Right now it's built in the same module with the core DM driver, so it's 
loaded any time DM is loaded, regardless of whether any DM module is using 
it. It should be fairly easy to split it out in its own module, which means 
that mempool won't be created until some other module is loaded that depends 
on kcopyd.

-- 
Kevin Corry
kevcorry@us.ibm.com
http://evms.sourceforge.net/

  reply	other threads:[~2004-06-10 13:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-02 15:41 [PATCH] 2/5: Device-mapper: kcopyd Alasdair G Kergon
2004-06-02 16:15 ` Andreas Dilger
2004-06-02 16:50   ` Kevin Corry
2004-07-03  5:44     ` Daniel Phillips
2004-06-02 21:15   ` Alasdair G Kergon
2004-06-03  3:41 ` Andrew Morton
2004-06-03 13:28   ` Alasdair G Kergon
2004-06-10  6:18 ` Andrew Morton
2004-06-10  8:16   ` Kevin Corry [this message]
2004-06-10 18:12     ` Andrew Morton
2004-06-10 14:55   ` Alasdair G Kergon

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=200406100816.18263.kevcorry@us.ibm.com \
    --to=kevcorry@us.ibm.com \
    --cc=agk@redhat.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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