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

Commit 683608c

Browse files
mem/pool: improve the scalable memory allocator.
- 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.
1 parent c483f7f commit 683608c

File tree

7 files changed

+717
-196
lines changed

7 files changed

+717
-196
lines changed

src/include/mem/zm_pool.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ typedef zm_ptr_t *zm_pool_t;
1313

1414
int zm_pool_create(size_t element_size, zm_pool_t *handle);
1515
int zm_pool_destroy(zm_pool_t *handle);
16-
int zm_pool_alloc(zm_pool_t handle, int tid, void **ptr);
17-
int zm_pool_free(zm_pool_t handle, int tid, void *ptr);
16+
int zm_pool_alloc(zm_pool_t handle, void **ptr);
17+
int zm_pool_free(zm_pool_t handle, void *ptr);
1818

1919
#endif /* _ZM_POOL_H_ */

src/include/queue/zm_queue_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct zm_msqnode {
4141
struct zm_msqueue {
4242
zm_atomic_ptr_t head ZM_ALLIGN_TO_CACHELINE;
4343
zm_atomic_ptr_t tail ZM_ALLIGN_TO_CACHELINE;
44-
zm_pool_t pool;
44+
zm_pool_t pool ZM_ALLIGN_TO_CACHELINE;
4545
};
4646

4747
/* faqueue */

src/include/queue/zm_swpqueue.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ int zm_swpqueue_dequeue(zm_swpqueue_t* q, void **data);
1515
int zm_swpqueue_isempty_weak(zm_swpqueue_t* q);
1616
int zm_swpqueue_isempty_strong(zm_swpqueue_t* q);
1717

18-
int zm_swpqueue_init_explicit(zm_swpqueue_t *, int);
19-
int zm_swpqueue_enqueue_explicit(zm_swpqueue_t* q, void *data, int);
20-
int zm_swpqueue_dequeue_explicit(zm_swpqueue_t* q, void **data, int);
18+
int zm_swpqueue_init_explicit(zm_swpqueue_t *);
19+
int zm_swpqueue_enqueue_explicit(zm_swpqueue_t* q, void *data);
20+
int zm_swpqueue_dequeue_explicit(zm_swpqueue_t* q, void **data);
2121

2222

2323
#endif /* _ZM_SWPQUEUE_H */

0 commit comments

Comments
 (0)