Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200410170407.GQ11469@brightrain.aerifal.cx>
Date: Fri, 10 Apr 2020 13:04:07 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: Concrete case-by-case examples of mallocng @ low usage

The following are tables of initial allocation behavior for all sizes
up through 16k assuming 4k page size. The fine classing figures won't
actually be used for initial allocations, but I've included them for
comparison to illustrate why coarse classes are used. These numbers
were all done by hand independently of the code, so that if actual
behavior differs, it indicates a bug in one or the other.


First 16 size classes, no coarse classing:

     0-12: 2x2032 -> 2x1008 -> 2x496 -> 30x16
    13-28: 2x2032 -> 2x1008 -> 2x496 -> 15x32
    29-44: 2x2032 -> 2x1008 -> 2x496 -> 10x48
    45-60: 2x2032 -> 2x1008 -> 2x496 -> 7x64
    61-76: 2x2032 -> 2x1008 -> 2x496 -> 6x80
    77-92: 2x2032 -> 2x1008 -> 2x496 -> 5x96
   93-108: 2x2032 -> 2x1008 -> 2x496 -> 4x112
  109-124: 2x2032 -> 2x1008 -> 7x128

  125-140: 2x2032 -> 2x1008 -> 7x144
  141-156: 2x2032 -> 2x1008 -> 2x496 -> 3x160
  157-188: 2x2032 -> 2x1008 -> 5x192
  189-236: 2x2032 -> 2x1008 -> 2x496 -> 2x240

  237-272: 2x2032 -> 7x288
  273-332: 2x2032 -> 2x1008 -> 3x336
  333-396: 2x2032 -> 5x400
  397-492: 2x2032 -> 2x1008 -> 2x496


Coarse classing for classes 16-31:

  493-668: 2x2032 -> 3x672
 669-1004: 2x2032 -> 2x1008

1005-1356: 3x1360 (1 page)
1357-2028: 2x2032 (1 page)

2029-2716: 3x2720 (2 pages)
2717-4076: 1x4080 (1 page)

4077-5452: 2x5456 (3 pages)
5453-8172: 1x8176 (2 pages)


Fine classing for classes 16-31:

  493-572: 7x576
  573-668: 2x2032 -> 3x672
  669-812: 5x816
 813-1004: 2x2032 -> 2x1008

1005-1164: 7x1168 (2 pages)
1165-1356: 3x1360 (1 page)
1357-1628: 5x1632 (2 pages)
1629-2028: 2x2032 (1 page)

2029-2332: 5x2336 (3 pages)
2333-2716: 3x2720 (2 pages)
2717-3260: 5x3264 (4 pages)
3261-4076: 1x4080 (1 page)

4077-4668: 5x4672 (6 pages)
4669-5452: 2x5456 (3 pages)
5453-6540: 3x6544 (5 pages)
6541-8172: 1x8176 (2 pages)


Individual mmap for classes 32+:

8173-12268: 3 pages
12269-16364: 4 pages
16365-20460: 5 pages
...

And for comparison to without individual mmap, fine classes:

8173-9340: 3x9344 (7 pages)
9341-10908: 1x10912 (3 pages)
10909-13084: 3x13088 (10 pages)
13085-16364: 1x16386 (4 pages)
16365-18700: 3x18704 (14 pages)
18701-21820: 1x21824 (6 pages)
...

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.