question about Jemalloc purging order

mmzsmm mmzsmm at
Thu Jan 7 18:46:24 PST 2016


I have been reading the Je source code, and I have some question about the purging order.
The fisrt one is , according to the code comments, the clean-dirty fragmentation is measured as,

* Order such that chunks with higher fragmentation are "less than"
* those with lower fragmentation -- purging order is from "least" to
* "greatest".
    mean current avail run size                 nruns_avail-nruns_adjac
--------------------------------------------  =  ----------------------------------
mean defragmented avail run size                  nruns_avail

So if I have a chunkA with avail_runs = 10, adjac = 1, and another chunkB with avail_runs = 20, adjac = 5.
Obviously, the fragmentA(0.9) > fragmentB(0.75), so the A will be prior to B in the dirty chunk tree, and
will be purged first. But the chunkB truely has more adjacs than the A, and the performace gain after purging
chunkA is also less than the other(0.1 vs 0.25). Why we prefer to purge the chunk with "less adjacs"?
Shouldn't we purge more adjacs or clean-dirty fragments to acquire more continuous unalloc pages?

Another question is, I notice that before the git node e3d13060 there are two avail-trees, one is for dirty,
and another for clean,
    arena_avail_tree_t    runs_avail_clean;
    arena_avail_tree_t    runs_avail_dirty;
After that, the two became one. So how to ensure the new runs allocaction to prefer to dirty pages?
Is the modification will cause more performance regression than before?

That's all, thanks.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the jemalloc-discuss mailing list