All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: lvm-devel@redhat.com
Subject: lvm and locales memory issue
Date: Wed, 24 Feb 2010 10:39:17 +0100	[thread overview]
Message-ID: <4B84F3C5.9060100@redhat.com> (raw)
In-Reply-To: <20100223162842.GC2817@tyan-ft48-01.lab.bos.redhat.com>

On 23.2.2010 17:28, Jakub Jelinek wrote:
>> Another note could be - Ubuntu does not even use locale-archive file and uses
>> locales on per file basis - so now I'm getting curious, where are the tests,
> 
> Not everything Ubuntu does is necessarily a good idea.
> 
>> that proves that Fedora gets some measurable performance advantage?
> 
> Try something trivial, like:
> #include <locale.h>
> 
> int
> main (void)
> {
>   int i;
>   for (i = 0; i < 1000000; i++)
>     switch (i % 5)
>       {
>       case 0: setlocale (LC_ALL, "C"); break;
>       case 1: setlocale (LC_ALL, "en_US.UTF-8"); break;
>       case 2: setlocale (LC_ALL, "cs_CZ.UTF-8"); break;
>       case 3: setlocale (LC_ALL, "fr_FR.UTF-8"); break;
>       case 4: setlocale (LC_ALL, "de_DE.UTF-8"); break;
>       }
>   return 0;
> }
> 
> With locale-archive 1.362s, without, using locale files, 10.355s.  And


>From looking into the code and keeping in mind we need to handle these
millions of switches per second as a killer feature - there seems to be nice
way -  instead of doing one large mmap call - how about doing several
smaller sized mmap just for regions needed by given locale.

Once mmap-ed - it will stay in program's memory till its exit just like now...

So - instead of one large 100MB mmap - we would end for this 'benchmark'
with maybe 8-10 mmap calls per setlocale - so let's say 50 mmap calls for
small memory regions. (or less - depends on how the locale-archive is
organized - maybe everything except LC_CTYPE & LC_COLLATE could be in on
mmaped area)

As a bonus - for the most common use-case - it might eat less pgt entries
(I assume its ~190kb for x86_64 and 100MB file)
On the opposite site - user of all locales at once would waste memory by
having some pages mmmaped multiple times....

Zdenek



      parent reply	other threads:[~2010-02-24  9:39 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-18  9:19 lvm and locales memory issue Zdenek Kabelac
2010-02-18 12:48 ` Milan Broz
2010-02-18 13:26   ` Zdenek Kabelac
2010-02-19 16:11     ` Zdenek Kabelac
2010-02-19 16:30       ` Alasdair G Kergon
2010-02-22 10:55         ` Zdenek Kabelac
2010-02-22 13:16           ` Zdenek Kabelac
2010-02-22 18:11             ` Alasdair G Kergon
2010-02-22 18:23               ` Jakub Jelinek
2010-02-22 18:51                 ` Alasdair G Kergon
2010-02-22 19:05                   ` Jakub Jelinek
2010-02-23  8:52                 ` Zdenek Kabelac
2010-02-23  9:15                   ` Jakub Jelinek
2010-02-23  9:14                     ` Zdenek Kabelac
2010-02-23  9:45                       ` Jakub Jelinek
2010-02-23 10:12                         ` Zdenek Kabelac
2010-02-23 13:07                     ` Zdenek Kabelac
2010-02-23 15:17                   ` Zdenek Kabelac
2010-02-23 16:28                     ` Jakub Jelinek
2010-02-23 16:53                       ` Alasdair G Kergon
2010-02-23 16:56                       ` Zdenek Kabelac
2010-02-24  9:39                       ` Zdenek Kabelac [this message]

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=4B84F3C5.9060100@redhat.com \
    --to=zkabelac@redhat.com \
    --cc=lvm-devel@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.