From: phcoder <phcoder@gmail.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] dynamic cache allocation
Date: Sun, 08 Mar 2009 13:55:01 +0100 [thread overview]
Message-ID: <49B3C025.5000201@gmail.com> (raw)
In-Reply-To: <20090308124359.GA28707@thorin>
Robert Millan wrote:
> On Sat, Mar 07, 2009 at 11:54:18PM +0100, phcoder wrote:
>> + grub_disk_cache_table = (struct grub_disk_cache *)
>> + grub_malloc (grub_disk_cache_num * sizeof (struct grub_disk_cache));
>> [...]
>> + By default use up to one quarter of memory available for allocation */
>> +#define GRUB_DISK_CACHE_DIVIDE 16536
>
> I might be missing something, but I think this implies our cache will stop
> working if the memory map doesn't include a contigous block that is as big
> as one quarter of total memory.
>
It uses the indirection. The space that is allocated by this code is
only for the cache index. Every index entry is 20 bytes and describes a
cache entry of 4096 bytes. So for cache to work we need just a block of
size of 1/800 of free allocatable memory (not the total memory but only
the memory which was announced to mm.c as free). On the BIOS system with
3GB only 1/4 of available memory is announced as free (it's probably
different with Vesa's new allocator). It means that cache index will
take about 1MiB (about 4MiB if Vesa's allocator uses memory better)
> I think we should be more conservative and define an upper bound for how
> big our cache is supposed to be in a normal use case. In most cases, we'll
> have as much memory available as we need for this purpose, and it's only a
> few situations (i.e. machines with very low memory) that might be a problem.
>
> Thoughts?
>
--
Regards
Vladimir 'phcoder' Serbinenko
next prev parent reply other threads:[~2009-03-08 12:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-07 22:54 [PATCH] dynamic cache allocation phcoder
2009-03-08 12:43 ` Robert Millan
2009-03-08 12:55 ` phcoder [this message]
2009-03-08 13:34 ` Vesa Jääskeläinen
2009-03-08 16:26 ` phcoder
2009-03-08 21:32 ` phcoder
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=49B3C025.5000201@gmail.com \
--to=phcoder@gmail.com \
--cc=grub-devel@gnu.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 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.