Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Oct 2020 16:36:03 +0100
From:      Mateusz Guzik <mjguzik@gmail.com>
To:        Mark Johnston <markj@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r367165 - head/sys/fs/tmpfs
Message-ID:  <CAGudoHHLQT-81Aa_XVPtR7BwAdbjZPNmz2G5EcggmR=uVg0a%2Bg@mail.gmail.com>
In-Reply-To: <20201030145143.GB60293@raichu>
References:  <202010301407.09UE7Phw060731@repo.freebsd.org> <CAGudoHGBMFoeOKwZWq2%2B1xC9924Xi2AEt4a1zYgwa_EA3HzAkA@mail.gmail.com> <20201030145143.GB60293@raichu>

next in thread | previous in thread | raw e-mail | index | archive | help
On 10/30/20, Mark Johnston <markj@freebsd.org> wrote:
> On Fri, Oct 30, 2020 at 03:08:32PM +0100, Mateusz Guzik wrote:
>> On 10/30/20, Mateusz Guzik <mjg@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>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGudoHHLQT-81Aa_XVPtR7BwAdbjZPNmz2G5EcggmR=uVg0a%2Bg>