Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DAOS-13701: Memory bucket allocator API definition #13152

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/common/ad_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1147,8 +1147,8 @@ umo_tx_free(struct umem_instance *umm, umem_off_t umoff)
}

static umem_off_t
umo_tx_alloc(struct umem_instance *umm, size_t size, uint64_t flags,
unsigned int type_num)
umo_tx_alloc(struct umem_instance *umm, size_t size, uint64_t flags, unsigned int type_num,
unsigned int mbkt_id)
{
struct ad_tx *tx = tx_get();
struct ad_blob_handle bh = umm2ad_blob_hdl(umm);
Expand Down Expand Up @@ -1242,7 +1242,8 @@ umo_tx_add_ptr(struct umem_instance *umm, void *ptr, size_t size)
}

static umem_off_t
umo_reserve(struct umem_instance *umm, void *act, size_t size, unsigned int type_num)
umo_reserve(struct umem_instance *umm, void *act, size_t size, unsigned int type_num,
unsigned int mbkt_id)
{
struct ad_blob_handle bh = umm2ad_blob_hdl(umm);
struct ad_reserv_act *ract = act;
Expand Down Expand Up @@ -1330,9 +1331,10 @@ umo_atomic_copy(struct umem_instance *umm, void *dest, const void *src, size_t l
}

static umem_off_t
umo_atomic_alloc(struct umem_instance *umm, size_t size, unsigned int type_num)
umo_atomic_alloc(struct umem_instance *umm, size_t size, unsigned int type_num,
unsigned int mbkt_id)
{
return umo_tx_alloc(umm, size, 0, type_num);
return umo_tx_alloc(umm, size, 0, type_num, mbkt_id);
}

static int
Expand Down
25 changes: 15 additions & 10 deletions src/common/dav/bucket.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause */
/* Copyright 2015-2022, Intel Corporation */
/* Copyright 2015-2023, Intel Corporation */

/*
* bucket.c -- bucket implementation
Expand All @@ -23,15 +23,13 @@

struct bucket {
/* this struct is both the lock guard and the locked state */
struct bucket_locked *locked;

struct alloc_class *aclass;

struct block_container *container;
struct bucket_locked *locked;
struct alloc_class *aclass;
struct block_container *container;
const struct block_container_ops *c_ops;

struct memory_block_reserved *active_memory_block;
int is_active;
struct memory_block_reserved *active_memory_block;
struct zoneset *zset;
int is_active;
};

struct bucket_locked {
Expand Down Expand Up @@ -77,7 +75,7 @@ bucket_fini(struct bucket *b)
* bucket_locked_new -- creates a new locked bucket instance
*/
struct bucket_locked *
bucket_locked_new(struct block_container *c, struct alloc_class *aclass)
bucket_locked_new(struct block_container *c, struct alloc_class *aclass, struct zoneset *zset)
{
ASSERTne(c, NULL);

Expand All @@ -92,6 +90,7 @@ bucket_locked_new(struct block_container *c, struct alloc_class *aclass)

util_mutex_init(&b->lock);
b->bucket.locked = b;
b->bucket.zset = zset;

return b;

Expand Down Expand Up @@ -268,3 +267,9 @@ bucket_active_block(struct bucket *b)
{
return b->is_active ? b->active_memory_block : NULL;
}

struct zoneset *
bucket_get_zoneset(struct bucket *b)
{
return b->zset;
}
8 changes: 5 additions & 3 deletions src/common/dav/bucket.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: BSD-3-Clause */
/* Copyright 2015-2021, Intel Corporation */
/* Copyright 2015-2023, Intel Corporation */

/*
* bucket.h -- internal definitions for bucket
Expand All @@ -21,8 +21,8 @@
struct bucket_locked;
struct bucket;

struct bucket_locked *bucket_locked_new(struct block_container *c,
struct alloc_class *aclass);
struct bucket_locked *
bucket_locked_new(struct block_container *c, struct alloc_class *aclass, struct zoneset *zset);

struct bucket *bucket_acquire(struct bucket_locked *b);
void bucket_release(struct bucket *b);
Expand All @@ -41,5 +41,7 @@ int bucket_detach_run(struct bucket *b,
struct memory_block_reserved *bucket_active_block(struct bucket *b);

void bucket_locked_delete(struct bucket_locked *b);
struct zoneset *
bucket_get_zoneset(struct bucket *b);

#endif /* __DAOS_COMMON_BUCKET_H */
Loading