Skip to content

Commit

Permalink
HP_MALLOC: Fine-tune the "frag split size" constants
Browse files Browse the repository at this point in the history
It seems that "split on 4096 or larger" is too large a value, leading to
fragmentation issues on typical 1G - 4G SHM pools.

With this patch, HP_MALLOC will visibly use less shared memory, but will
also split fragments more often.
  • Loading branch information
liviuchircu committed Mar 2, 2022
1 parent 1c4a8a5 commit 043d4f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mem/hp_malloc.c
Expand Up @@ -43,8 +43,8 @@
#define MIN_FRAG_SIZE ROUNDTO

/* only perform a split if the resulting free fragment is at least this size */
#define MIN_SHM_SPLIT_SIZE 4096
#define MIN_PKG_SPLIT_SIZE 256
#define MIN_SHM_SPLIT_SIZE 256
#define MIN_PKG_SPLIT_SIZE 128

#define FRAG_NEXT(f) ((struct hp_frag *)(void *)((char *)((f) + 1) + (f)->size))

Expand Down

0 comments on commit 043d4f3

Please sign in to comment.