mirror of
https://github.com/wassname/ray.git
synced 2026-08-02 13:01:01 +08:00
Increase dlmalloc threshold along with granularity (#33)
* Increase allocation granularity dynamically with each MMAP call * Fewer MMAP calls required when workload contains several objects. * Delay hitting the per-process file descriptor constraint. * Change type of GRANULARITY_MULTIPLIER * Make granularity update more concise. * Increase dlmalloc threshold along with granularity * Eventually resolve issue of objects being allocated their own file if larger than dlmalloc threshold * Avoid dlmalloc threshold and granularity integer overflow * Update granularity directly without invoking dlmallopt * Set the threshold to a fixed size (MAX_SIZE_T) * Removed trailing whitespace
This commit is contained in:
committed by
Robert Nishihara
parent
eabfa9ab6f
commit
5a0725ce94
+4
-6
@@ -13,15 +13,14 @@
|
||||
void *fake_mmap(size_t);
|
||||
int fake_munmap(void *, size_t);
|
||||
|
||||
size_t dlmalloc_granularity = ((size_t) 128U * 1024U);
|
||||
|
||||
#define MMAP(s) fake_mmap(s)
|
||||
#define MUNMAP(a, s) fake_munmap(a, s)
|
||||
#define DIRECT_MMAP(s) fake_mmap(s)
|
||||
#define DIRECT_MUNMAP(a, s) fake_munmap(a, s)
|
||||
#define USE_DL_PREFIX
|
||||
#define HAVE_MORECORE 0
|
||||
#define DEFAULT_GRANULARITY (dlmalloc_granularity)
|
||||
#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T
|
||||
#define DEFAULT_GRANULARITY ((size_t) 128U * 1024U)
|
||||
|
||||
#include "thirdparty/dlmalloc.c"
|
||||
|
||||
@@ -84,9 +83,8 @@ void *fake_mmap(size_t size) {
|
||||
return pointer;
|
||||
}
|
||||
|
||||
/* Update dlmalloc's allocation granularity for future calls */
|
||||
dlmalloc_granularity *= GRANULARITY_MULTIPLIER;
|
||||
dlmallopt(M_GRANULARITY, dlmalloc_granularity);
|
||||
/* Increase dlmalloc's allocation granularity directly. */
|
||||
mparams.granularity *= GRANULARITY_MULTIPLIER;
|
||||
|
||||
struct mmap_record *record = malloc(sizeof(struct mmap_record));
|
||||
record->fd = fd;
|
||||
|
||||
Reference in New Issue
Block a user