grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] dynamic cache allocation


From: phcoder
Subject: Re: [PATCH] dynamic cache allocation
Date: Sun, 08 Mar 2009 13:55:01 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20090105)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]