Skip to content

Commit

Permalink
DAOS-13883 cart: control request_post_init/incr through env vars
Browse files Browse the repository at this point in the history
Add D_POST_INIT / D_POST_INCR env vars

This enables tuning of multi-recv buffer sizes and number of server
preposted recvs when multi-recv is not enabled.

Required-githooks: true

Signed-off-by: Jerome Soumagne <jerome.soumagne@intel.com>
  • Loading branch information
soumagne committed Nov 1, 2023
1 parent a4f2de1 commit e4ad435
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/cart/crt_hg.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,9 @@ crt_hg_class_init(int provider, int idx, bool primary, hg_class_t **ret_hg_class
if (prov_data->cpg_max_unexp_size > 0)
init_info.na_init_info.max_unexpected_size = prov_data->cpg_max_unexp_size;

init_info.request_post_init = crt_gdata.cg_post_init;
init_info.request_post_incr = crt_gdata.cg_post_incr;

hg_class = HG_Init_opt(info_string, crt_is_service(), &init_info);
if (hg_class == NULL) {
D_ERROR("Could not initialize HG class.\n");
Expand Down
4 changes: 4 additions & 0 deletions src/cart/crt_hg.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
/** number of prepost HG handles when enable pool */
#define CRT_HG_POOL_PREPOST_NUM (16)

/** default values for init / incr to prepost handles */
#define CRT_HG_POST_INIT (512)
#define CRT_HG_POST_INCR (512)

struct crt_rpc_priv;
struct crt_common_hdr;
struct crt_corpc_hdr;
Expand Down
23 changes: 18 additions & 5 deletions src/cart/crt_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ dump_envariables(void)
"D_PORT_AUTO_ADJUST",
"D_POLL_TIMEOUT",
"D_LOG_FILE_APPEND_RANK",
"D_POST_INIT",
"D_POST_INCR",
"DAOS_SIGNAL_REGISTER"};

D_INFO("-- ENVARS: --\n");
Expand Down Expand Up @@ -258,7 +260,7 @@ prov_data_init(struct crt_prov_gdata *prov_data, crt_provider_t provider,
/* first step init - for initializing crt_gdata */
static int data_init(int server, crt_init_options_t *opt)
{
uint32_t timeout;
uint32_t timeout = 0;
uint32_t credits;
uint32_t fi_univ_size = 0;
uint32_t mem_pin_enable = 0;
Expand All @@ -273,6 +275,21 @@ static int data_init(int server, crt_init_options_t *opt)
D_DEBUG(DB_ALL, "Starting RPCID %#lx. Num cores: %ld\n",
crt_gdata.cg_rpcid, crt_gdata.cg_num_cores);

/* Set context post init / post incr to tune number of pre-posted recvs */
if (getenv("D_POST_INIT") != NULL) {
uint32_t post_init = 0;
d_getenv_int("D_POST_INIT", &post_init);
crt_gdata.cg_post_init = post_init;
} else
crt_gdata.cg_post_init = CRT_HG_POST_INIT;

if (getenv("D_POST_INCR") != NULL) {
uint32_t post_incr = 0;
d_getenv_int("D_POST_INCR", &post_incr);
crt_gdata.cg_post_incr = post_incr;
} else
crt_gdata.cg_post_incr = CRT_HG_POST_INCR;

is_secondary = 0;
/* Apply CART-890 workaround for server side only */
if (server) {
Expand All @@ -285,13 +302,9 @@ static int data_init(int server, crt_init_options_t *opt)
* is running using a secondary provider
*/
d_getenv_int("CRT_SECONDARY_PROVIDER", &is_secondary);

}

crt_gdata.cg_provider_is_primary = (is_secondary) ? 0 : 1;

timeout = 0;

if (opt && opt->cio_crt_timeout != 0)
timeout = opt->cio_crt_timeout;
else
Expand Down
4 changes: 4 additions & 0 deletions src/cart/crt_internal_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ struct crt_gdata {
/** */
struct crt_prov_gdata *cg_prov_gdata_secondary;

/** Hints to mercury for request post init (ignored for clients) */
uint32_t cg_post_init;
uint32_t cg_post_incr;

/** global timeout value (second) for all RPCs */
uint32_t cg_timeout;

Expand Down

0 comments on commit e4ad435

Please sign in to comment.