<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>204773</bug_id>
          
          <creation_ts>2019-12-02 15:58:33 -0800</creation_ts>
          <short_desc>[bmalloc] Move Chunk object to the very end of Chunk block.</short_desc>
          <delta_ts>2019-12-03 13:09:14 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>bmalloc</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=204286</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=204810</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Basuke Suzuki">basuke</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ggaren</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1594835</commentid>
    <comment_count>0</comment_count>
    <who name="Basuke Suzuki">basuke</who>
    <bug_when>2019-12-02 15:58:33 -0800</bug_when>
    <thetext>Currently the Chunk object data is located in the very beginning of chunk area. After this object, there are unused memory area left untouched through the life cycle of chunk area. Also in bug 204286, another unused area was found in the very end of it. It seems we can optimize usage of pages in chunk by moving Chunk object from beginning to end.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1594845</commentid>
    <comment_count>1</comment_count>
    <who name="Basuke Suzuki">basuke</who>
    <bug_when>2019-12-02 16:15:27 -0800</bug_when>
    <thetext>
                  | [current implementation]             | [tail Chunk]
page              | metadata    page    unused  unused   |      page
class   pageSize  |     size    count   head    tail     |      count   diff   unused
------------------------------------------------------------------------------------
0       4096      |     12288   253     2024    0        |      253     0      2024
1       8192      |     16384   126     6120    0        |      126     0      6120
2       12288     |     12288   84      2024    4096     |      84      0      6120
3       16384     |     16384   63      6120    0        |      63      0      6120
4       20480     |     20480   50      10216   4096     |      50      0      14312
5       24576     |     24576   41      14312   16384    |      42      1      6120
6       28672     |     28672   35      18408   16384    |      36      1      6120
7       32768     |     32768   31      22504   0        |      31      0      22504
8       36864     |     36864   27      26600   16384    |      28      1      6120
9       40960     |     40960   24      30696   24576    |      25      1      14312
10      45056     |     45056   22      34792   12288    |      23      1      2024
11      49152     |     49152   20      38888   16384    |      21      1      6120
12      53248     |     53248   18      42984   36864    |      19      1      26600
13      57344     |     57344   17      47080   16384    |      18      1      6120
14      61440     |     61440   16      51176   4096     |      16      0      55272
15      65536     |     65536   15      55272   0        |      15      0      55272

This is a quick research. We can get extra page in pageClass of 5, 6, 8, 9, 10, 11, 12 and 13.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1594846</commentid>
    <comment_count>2</comment_count>
    <who name="Basuke Suzuki">basuke</who>
    <bug_when>2019-12-02 16:15:40 -0800</bug_when>
    <thetext>https://docs.google.com/spreadsheets/d/1o1hQbh-EalCJ0v_1cOXupV7R25Dz5c8RmVGqYepjN2I/edit?usp=sharing</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1594853</commentid>
    <comment_count>3</comment_count>
    <who name="Basuke Suzuki">basuke</who>
    <bug_when>2019-12-02 16:22:22 -0800</bug_when>
    <thetext>Also unified unused memory region are easy to decommit at the beginning of chunk creation and won&apos;t be used until returned to large free. We will get additional decommittable pages like this:

                  | decommitable
page              | pages
class   pageSize  | 4k      16k
----------------------------------
0       4096      | 0       0
1       8192      | 1       0
2       12288     | 1       0
3       16384     | 1       0
4       20480     | 3       0
5       24576     | 1       0
6       28672     | 1       0
7       32768     | 5       1
8       36864     | 1       0
9       40960     | 3       0
10      45056     | 0       0
11      49152     | 1       0
12      53248     | 6       1
13      57344     | 1       0
14      61440     | 13      3
15      65536     | 13      3</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>