Skip to content

Commit

Permalink
pool: lc_pool_get_local -> lc_pool_get_local_id
Browse files Browse the repository at this point in the history
Rename lc_pool_get_local to better reflect what it actually does.
  • Loading branch information
omor1 committed Jun 10, 2020
1 parent 9809f95 commit 081bab4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
8 changes: 4 additions & 4 deletions include/lc/pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void* lc_pool_get_nb(lc_pool* pool);

#define POOL_UNINIT ((int32_t)-1)

LC_INLINE int32_t lc_pool_get_local(struct lc_pool* pool)
LC_INLINE int32_t lc_pool_get_local_id(struct lc_pool* pool)
{
int wid = lc_worker_id();
int32_t pid = tls_pool_struct[wid][pool->key];
Expand Down Expand Up @@ -110,7 +110,7 @@ LC_INLINE void* lc_pool_steal(struct lc_pool* pool, int32_t pid)

LC_INLINE void lc_pool_put(struct lc_pool* pool, void* elm)
{
int32_t pid = lc_pool_get_local(pool);
int32_t pid = lc_pool_get_local_id(pool);
struct dequeue* lpool = pool->lpools[pid];
dq_push_top(lpool, elm);
}
Expand All @@ -123,7 +123,7 @@ LC_INLINE void lc_pool_put_to(struct lc_pool* pool, void* elm, int32_t pid)

LC_INLINE void* lc_pool_get_nb(struct lc_pool* pool)
{
int32_t pid = lc_pool_get_local(pool);
int32_t pid = lc_pool_get_local_id(pool);
struct dequeue* lpool = pool->lpools[pid];
void* elm = dq_pop_top(lpool);
if (elm == NULL)
Expand All @@ -133,7 +133,7 @@ LC_INLINE void* lc_pool_get_nb(struct lc_pool* pool)

LC_INLINE void* lc_pool_get(struct lc_pool* pool)
{
int32_t pid = lc_pool_get_local(pool);
int32_t pid = lc_pool_get_local_id(pool);
struct dequeue* lpool = pool->lpools[pid];
void* elm = NULL;
while (elm == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/include/server/server_ibv_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static inline void ibv_post_recv_(lc_server* s, lc_packet* p)
.num_sge = 1,
};

p->context.poolid = lc_pool_get_local(s->pkpool);
p->context.poolid = lc_pool_get_local_id(s->pkpool);

struct ibv_recv_wr* bad_wr = 0;
IBV_SAFECALL(ibv_post_srq_recv(s->dev_srq, &wr, &bad_wr));
Expand Down
2 changes: 1 addition & 1 deletion src/include/server/server_psm2.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ static inline void lc_server_post_recv(lc_server* s, lc_packet* p)
}

psm2_mq_tag_t rtag = PSM_TAG_TRECV_DATA();
p->context.poolid = lc_pool_get_local(s->pkpool);
p->context.poolid = lc_pool_get_local_id(s->pkpool);

PSM_SAFECALL(psm2_mq_irecv2(
s->mq, PSM2_MQ_ANY_ADDR, &rtag, /* message tag */
Expand Down
2 changes: 1 addition & 1 deletion src/long.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "lc/pool.h"

#ifdef LC_PKT_RET_LONG
#define LC_LONG_POOL_ID(ep) (lc_pool_get_local(ep->pkpool))
#define LC_LONG_POOL_ID(ep) (lc_pool_get_local_id(ep->pkpool))
#else
#define LC_LONG_POOL_ID(ep) (-1)
#endif
Expand Down
11 changes: 5 additions & 6 deletions src/medium.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
#include "lc_priv.h"
#include "lc/pool.h"

#define LC_MED_POOL_ID(ep, size) ((size > LC_PKT_RET_MED_SIZE) ? lc_pool_get_local_id(ep->pkpool) : -1)

lc_status lc_sendm(void* src, size_t size, int rank, int tag, lc_ep ep)
{
LC_POOL_GET_OR_RETN(ep->pkpool, p);
lci_pk_init(ep, (size > LC_PKT_RET_MED_SIZE) ? lc_pool_get_local(ep->pkpool) : -1,
LC_PROTO_DATA, p);
lci_pk_init(ep, LC_MED_POOL_ID(ep, size), LC_PROTO_DATA, p);
struct lci_rep* rep = &(ep->rep[rank]);
memcpy(p->data.buffer, src, size);
lc_server_sendm(ep->server, rep->handle, size, p,
Expand All @@ -19,8 +20,7 @@ lc_status lc_sendm(void* src, size_t size, int rank, int tag, lc_ep ep)
lc_status lc_putm(void* src, size_t size, int rank, uintptr_t addr, lc_ep ep)
{
LC_POOL_GET_OR_RETN(ep->pkpool, p);
lci_pk_init(ep, (size > LC_PKT_RET_MED_SIZE) ? lc_pool_get_local(ep->pkpool) : -1,
LC_PROTO_DATA, p);
lci_pk_init(ep, LC_MED_POOL_ID(ep, size), LC_PROTO_DATA, p);
struct lci_rep* rep = &(ep->rep[rank]);
memcpy(&p->data, src, size);
lc_server_putm(ep->server, rep->handle, rep->base, (uint32_t) (addr - rep->base),
Expand All @@ -31,8 +31,7 @@ lc_status lc_putm(void* src, size_t size, int rank, uintptr_t addr, lc_ep ep)
lc_status lc_putms(void* src, size_t size, int rank, uintptr_t addr, int meta, lc_ep ep)
{
LC_POOL_GET_OR_RETN(ep->pkpool, p);
lci_pk_init(ep, (size > LC_PKT_RET_MED_SIZE) ? lc_pool_get_local(ep->pkpool) : -1,
LC_PROTO_DATA, p);
lci_pk_init(ep, LC_MED_POOL_ID(ep, size), LC_PROTO_DATA, p);
struct lci_rep* rep = &(ep->rep[rank]);
memcpy(&p->data, src, size);
lc_server_putms(ep->server, rep->handle, rep->base, (uint32_t) (addr - rep->base),
Expand Down

0 comments on commit 081bab4

Please sign in to comment.