svn commit: r367165 - head/sys/fs/tmpfs

Mateusz Guzik mjguzik at gmail.com
Fri Oct 30 15:36:06 UTC 2020


On 10/30/20, Mark Johnston <markj at freebsd.org> wrote:
> On Fri, Oct 30, 2020 at 03:08:32PM +0100, Mateusz Guzik wrote:
>> On 10/30/20, Mateusz Guzik <mjg at freebsd.org> wrote:
>> > Author: mjg
>> > Date: Fri Oct 30 14:07:25 2020
>> > New Revision: 367165
>> > URL: https://svnweb.freebsd.org/changeset/base/367165
>> >
>> > Log:
>> >   tmpfs: change tmpfs dirent zone into a malloc type
>> >
>> >   It is 64 bytes.
>> >
>>
>> Right now malloc has only power-of-2 zones but I'm looking into
>> changing that. The allocator itself trivially extends to multiply of
>> 16, but stat collection needs reworking.
>
> Sums of consecutive powers of 2 also works well.  That is, 16, 16 + 8,
> 32, 32 + 16, ...
>
> When I last looked I didn't see very many places that would benefit, at
> least outside of ZFS.  Probably the main one is CAM CCBs, and that'll be
> helped by https://reviews.freebsd.org/D26844 .
>

I collected stats over part of make tinderbox, where they are rounded
up to mulitplies of 8. (so size of 5 is 1, size of 32 is 4). There is
huge demand for non-power-of-2 and a multiply of 16 is a conservative
adjustment which wont require more than a few workloads to compare
before/after.

For example you can see a solid contingent of 9 (72 bytes) which right
now is served from 128 byte zones.

dtrace -n 'fbt::malloc:entry { @ = lquantize(arg0 % 8 ? ((arg0 / 8) *
8 + 1) : arg0 / 8, 0, 32, 1); }'

           value  ------------- Distribution ------------- count
               0 |                                         0
               1 |                                         292436
               2 |                                         140962
               3 |                                         322732
               4 |@@@@@                                    12150230
               5 |                                         686069
               6 |                                         41067
               7 |@                                        2847728
               8 |@@@                                      6449825
               9 |@@                                       5794112
              10 |                                         1107100
              11 |                                         5913
              12 |                                         15392
              13 |                                         21885
              14 |                                         1852
              15 |                                         4100
              16 |                                         5177
              17 |@                                        1833685
              18 |                                         1541
              19 |                                         1567
              20 |                                         1189
              21 |                                         809
              22 |                                         7294
              23 |                                         423
              24 |                                         355
              25 |                                         364280
              26 |                                         450
              27 |                                         416
              28 |                                         444
              29 |                                         193
              30 |                                         83
              31 |                                         188
           >= 32 |@@@@@@@@@@@@@@@@@@@@@@@@@@               61740786

-- 
Mateusz Guzik <mjguzik gmail.com>


More information about the svn-src-head mailing list