Linux: Use huge pages in jemalloc to speed up allocations

Enable huge pages for jemalloc. This requests the Linux kernel to use
huge (2 MB) pages for large allocations. This has the effect of speeding
up first accesses to those allocations, and possibly also speeds up future
accesses by reducing TLB faults.

By default, 4 KB pages are used unless the user enables huge pages through
a kernel parameter or an obscure sysfs setting.

For Cycles benchmarks, this gives about a 5% CPU rendering performance
improvement. It likely also improves performance in other areas of Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/116663
This commit is contained in:
Eugene Kuznetsov
2024-01-16 16:37:40 +01:00
committed by Brecht Van Lommel
parent 766c1e2f8d
commit 10dfa07e36

View File

@@ -21,7 +21,7 @@
/* If JEMALLOC is used, it reads this global variable and enables background
* threads to purge dirty pages. Otherwise we release memory too slowly or not
* at all if the thread that did the allocation stays inactive. */
const char *malloc_conf = "background_thread:true,dirty_decay_ms:4000";
const char *malloc_conf = "background_thread:true,dirty_decay_ms:4000,thp:always,metadata_thp:always";
#endif
/* NOTE: Keep in sync with MEM_use_lockfree_allocator(). */