Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Commit

Permalink
mem/pool: improve the scalable memory allocator.
Browse files Browse the repository at this point in the history
- thread ID is no longer needed.
- Add an embedded option "USE_PAGE".
  With USE_PAGE, allocation becomes page-level.
  Without USE_PAGE, allocation becomes object-level.
  • Loading branch information
shintaro-iwasaki committed Sep 4, 2018
1 parent c483f7f commit 683608c
Show file tree
Hide file tree
Showing 7 changed files with 717 additions and 196 deletions.
4 changes: 2 additions & 2 deletions src/include/mem/zm_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef zm_ptr_t *zm_pool_t;

int zm_pool_create(size_t element_size, zm_pool_t *handle);
int zm_pool_destroy(zm_pool_t *handle);
int zm_pool_alloc(zm_pool_t handle, int tid, void **ptr);
int zm_pool_free(zm_pool_t handle, int tid, void *ptr);
int zm_pool_alloc(zm_pool_t handle, void **ptr);
int zm_pool_free(zm_pool_t handle, void *ptr);

#endif /* _ZM_POOL_H_ */
2 changes: 1 addition & 1 deletion src/include/queue/zm_queue_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct zm_msqnode {
struct zm_msqueue {
zm_atomic_ptr_t head ZM_ALLIGN_TO_CACHELINE;
zm_atomic_ptr_t tail ZM_ALLIGN_TO_CACHELINE;
zm_pool_t pool;
zm_pool_t pool ZM_ALLIGN_TO_CACHELINE;
};

/* faqueue */
Expand Down
6 changes: 3 additions & 3 deletions src/include/queue/zm_swpqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ int zm_swpqueue_dequeue(zm_swpqueue_t* q, void **data);
int zm_swpqueue_isempty_weak(zm_swpqueue_t* q);
int zm_swpqueue_isempty_strong(zm_swpqueue_t* q);

int zm_swpqueue_init_explicit(zm_swpqueue_t *, int);
int zm_swpqueue_enqueue_explicit(zm_swpqueue_t* q, void *data, int);
int zm_swpqueue_dequeue_explicit(zm_swpqueue_t* q, void **data, int);
int zm_swpqueue_init_explicit(zm_swpqueue_t *);
int zm_swpqueue_enqueue_explicit(zm_swpqueue_t* q, void *data);
int zm_swpqueue_dequeue_explicit(zm_swpqueue_t* q, void **data);


#endif /* _ZM_SWPQUEUE_H */
Loading

0 comments on commit 683608c

Please sign in to comment.