public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: matsunaga <matsunaga_kazuhisa@yahoo.co.jp>
Cc: linux-mtd@lists.infradead.org
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] 1/2 central workspace for zlib
Date: Mon, 2 Jun 2003 17:36:56 +0200	[thread overview]
Message-ID: <20030602153656.GA679@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <002901c32919$ddc37000$570486da@w0a3t0>

On Tue, 3 June 2003 00:15:56 +0900, matsunaga wrote:
> 
> But I still would like to stick to performance.
> (Though I haven't evaluated the performance yet...)
> So far I think MTD is used mostly on Embedded device, 
> in which single CPU which is not so powerful is used.
> 
> How is the following code (it is ugly though)?
> 
> static void default_workspace[WSIZE];
> 
> <snip>
> 
>     size = MAX(sizeof(struct inflate_workspace),
>         sizeof(struct deflate_workspace));
> 
>     if(WSIZE < size)
>         BUG();
> 
>     zlib_workspace[0] = default_workspace;
> 
>     for (i=1; i<smp_num_cpus; i++) {
>         zlib_workspace[i] = vmalloc(size);
>         if (!zlib_workspace[i]) {
>             zlib_exit();
>             return -ENOMEM;
>         }
>    }

Not bad.  We can even do a little better.  Since only one workspace is
really absolutely necessary (ignoring the siftirq case), there is no
need to fail anymore.  If we don't get enough memory for all
workspaces, initialize the semaphore to be a little lower and live
with fewer workspaces.

I like your ideas, really! :)

> There is another vmalloc in mtdblock_open()...;-)

...that is not trivial to get rid of.  Image the case where two
processes are writing to two devices.  With two buffers, we do rmew
whenever switching blocks for one device.  With one buffer, we have to
do it for every context switch between those two processes, which will
wear down the flash a lot faster.

Considering that mtdblock should not be performance critical in
production use anyway, this is a very hard problem.  What do you
think?

Jörn

-- 
The only real mistake is the one from which we learn nothing.
-- John Powell

  reply	other threads:[~2003-06-02 15:36 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-30 14:49 [PATCH RFC] 1/2 central workspace for zlib Jörn Engel
2003-05-30 15:29 ` James Morris
2003-05-30 17:43   ` Jörn Engel
2003-05-31  0:14     ` David S. Miller
2003-05-31  6:48       ` Jörn Engel
2003-05-31  6:55         ` David S. Miller
2003-05-31  7:56           ` Jörn Engel
2003-05-31  7:59             ` David S. Miller
2003-05-31  8:11               ` Jörn Engel
2003-05-31  8:12                 ` David S. Miller
2003-05-31  8:22             ` Con Kolivas
2003-06-01  1:25               ` Matt Mackall
2003-06-02 12:19                 ` Jörn Engel
2003-05-31  9:09             ` Arjan van de Ven
2003-05-31  6:20   ` David S. Miller
2003-05-31 10:51     ` James Morris
2003-05-31 11:07       ` Jörn Engel
2003-05-31 15:44 ` Joakim Tjernlund
2003-06-02 12:26   ` Jörn Engel
2003-06-02 13:03     ` Joakim Tjernlund
2003-06-02 13:32       ` Jörn Engel
2003-06-02 15:15 ` matsunaga
2003-06-02 15:36   ` Jörn Engel [this message]
2003-06-02 15:40     ` David Woodhouse
2003-06-02 15:53       ` Jörn Engel
2003-06-02 15:59         ` David Woodhouse
2003-06-02 16:37           ` Jörn Engel
2003-06-02 19:36             ` David Woodhouse
2003-06-02 20:54               ` Jörn Engel
2003-06-02 16:07     ` matsunaga

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=20030602153656.GA679@wohnheim.fh-wedel.de \
    --to=joern@wohnheim.fh-wedel.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=matsunaga_kazuhisa@yahoo.co.jp \
    /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