arc cache: pagesize and/or power of 2 constraints?

Alexander Leidinger Alexander at Leidinger.net
Thu Jul 29 13:00:47 UTC 2010


Quoting Andriy Gapon <avg at icyb.net.ua> (from Thu, 29 Jul 2010 15:29:42 +0300):

> on 29/07/2010 10:31 Alexander Leidinger said the following:
>> Hi,
>>
>> while writting some acceptance tests for the Solaris machines at work I
>> wondered if the size of the arc cache should be a multiple of the page
>> size and/or a power of 2. I searched the net, but was not able to find
>> some info regarding this.
>
> I suppose you mean ZFS ARC, not an ARC concept in general.

Yes.

> I wonder why you came at this question.
>
>> I would expect that it does not make sense to have an arc cache size
>> which is not a multiple of the page size.
>
> Why?

Does it make sense to allocate less than a memory page in the kernel?  
When I allocate in the same kernel-subsystem two times 1/4 of a memory  
page, can the allocations end up in the same memory page? If two  
independend subsystems try to do the same, can the allocations end up  
in the same page?

>> And depending on how the arc
>> cache is implemented, it would make sense to have it even as a power of
>> 2 size (even if it is able to handle non-power-of-2 sizes).
>
> Why?

If something is working on a binary tree of pages, you could end up in  
a case where you waste a page, if the size is not related to (2^n +/-  
x) * pagesize.

Yes, this is bean-counting.

>> Did someone had a look at this in FreeBSD?
>
> ARC size is almost arbitrary.
> It's a collection of malloc/uma allocated buffers of various sizes,  
> individual
> sizes are various multiples of 512.

So it would make sense to set the size to n*512 (instead to e.g.  
n*512+x with 0 < x < 512)?

Bye,
Alexander.

-- 
BOFH excuse #102:

Power company testing new voltage spike (creation) equipment

http://www.Leidinger.net    Alexander @ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org       netchild @ FreeBSD.org  : PGP ID = 72077137


More information about the freebsd-fs mailing list