<div dir="ltr"><span style="font-size:13px">Hi,</span><br style="font-size:13px"><span style="font-size:13px">I have an application running on x86 that uses jemalloc which can greatly benefit from an allocation pool of 24 bytes.</span><br style="font-size:13px"><span style="font-size:13px">currently there are pools for 8,16,32...</span><br style="font-size:13px"><span style="font-size:13px">I've tried changing include/jemalloc/internal/</span><span style="font-size:13px">size_classes.sh with the following patch:</span><br style="font-size:13px"><span style="font-size:13px">------------------------------</span><span style="font-size:13px">------------------------------</span><span style="font-size:13px">----------------------</span><br style="font-size:13px"><span style="font-family:monospace">-# The range of tiny size classes is [2^lg_tmin..2^(lg_q-1)].</span><br style="font-family:monospace"><span style="font-family:monospace">+# The range of tiny size classes is [2^lg_tmin..2^(lg_q+1)].</span><br style="font-family:monospace"><span style="font-family:monospace"> lg_tmin=3</span><br style="font-family:monospace"><span style="font-family:monospace"> </span><br style="font-family:monospace"><span style="font-family:monospace"> # Range of page sizes.</span><br style="font-family:monospace"><span style="font-family:monospace">@@ -48,11 +48,11 @@</span><br style="font-family:monospace"><span style="font-family:monospace"> echo "#define SIZE_CLASSES \\"</span><br style="font-family:monospace"><span style="font-family:monospace"> </span><br style="font-family:monospace"><span style="font-family:monospace"> # Tiny size classes.</span><br style="font-family:monospace"><span style="font-family:monospace">- while [ ${sz} -lt ${q} ] ; do</span><br style="font-family:monospace"><span style="font-family:monospace">+ while [ ${sz} -lt $((${q}*2)) ] ; do</span><br style="font-family:monospace"><span style="font-family:monospace"> echo " SIZE_CLASS(${bin}, ${delta}, ${sz}) \\"</span><br style="font-family:monospace"><span style="font-family:monospace"> bin=$((${bin} + 1))</span><br style="font-family:monospace"><span style="font-family:monospace"> psz=${sz}</span><br style="font-family:monospace"><span style="font-family:monospace">- sz=$((${sz} + ${sz}))</span><br style="font-family:monospace"><span style="font-family:monospace">+ sz=$((${sz} + ${t}))</span><br style="font-family:monospace"><span style="font-family:monospace"> delta=$((${sz} - ${psz}))</span><br style="font-family:monospace"><span style="font-family:monospace"> done</span><br style="font-size:13px"><span style="font-size:13px">------------------------------</span><span style="font-size:13px">------------------------------</span><span style="font-size:13px">---------------------- </span><br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">now, my size classes table looks like this:</span><br style="font-size:13px"><span style="font-size:13px">------------------------------</span><span style="font-size:13px">------------------------------</span><span style="font-size:13px">---------------------- </span><br style="font-size:13px"><span style="font-family:monospace">/* SIZE_CLASS(bin, delta, sz) */</span><br style="font-family:monospace"><span style="font-family:monospace">#define SIZE_CLASSES \</span><br style="font-family:monospace"><span style="font-family:monospace"> SIZE_CLASS(0, 8, 8) \</span><br style="font-family:monospace"><span style="font-family:monospace"> SIZE_CLASS(1, 8, 16) \</span><br style="font-family:monospace"><span style="font-family:monospace"> SIZE_CLASS(2, 8, 24) \</span><br style="font-family:monospace"><span style="font-family:monospace"> SIZE_CLASS(3, 8, 32) \</span><br style="font-family:monospace"><span style="font-family:monospace"> SIZE_CLASS(4, 16, 48) \</span><br style="font-family:monospace"><span style="font-family:monospace"> SIZE_CLASS(5, 16, 64) \</span><br style="font-size:13px"><span style="font-size:13px">------------------------------</span><span style="font-size:13px">------------------------------</span><span style="font-size:13px">---------------------- </span><br style="font-size:13px"><span style="font-size:13px">it seems to work fine, but i'm not sure if there are some side-effects.</span><br style="font-size:13px"><span style="font-size:13px">the 32 bytes pool which had delta of 16, now has a delta of 8.</span><br style="font-size:13px"><span style="font-size:13px">i see in the implementation of the </span><span style="font-family:monospace">SIZE_CLASS</span><span style="font-size:13px"> macro, that the 'sz' argument isn't used at all, and the delta argument </span><span style="font-size:13px;font-weight:bold">is</span><span style="font-size:13px">.</span><br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">another approach might be to change LG_QUANTUM to 3 rather than 4.</span><br style="font-size:13px"><span style="font-size:13px">i think this will create several new small size classes, but may also have undesired side-effects.</span><br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">can you please tell me if i got it right? what are the side-effects? or what is the right way to achieve what I'm trying to do?</span><br style="font-size:13px"><span style="font-size:13px">thanks.</span><br><div class="gmail_signature"><div dir="ltr"></div></div>
<div><span style="font-size:13px"> Oran.</span></div></div>