Skip to content
Closed
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
2 changes: 1 addition & 1 deletion src/container/srv_container.c
Original file line number Diff line number Diff line change
Expand Up @@ -2245,7 +2245,7 @@ cont_svc_eph_track_leader_start(struct cont_svc *svc)

D_ASSERT(svc->cs_cont_ephs_leader_req == NULL);
uuid_clear(anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, &anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, 0, &anonym_uuid);
svc->cs_cont_ephs_leader_req = sched_create_ult(&attr, cont_track_eph_leader_ult, svc, 0);
if (svc->cs_cont_ephs_leader_req == NULL) {
D_ERROR(DF_UUID" Failed to create EC leader eph ULT.\n",
Expand Down
4 changes: 2 additions & 2 deletions src/container/srv_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ cont_start_agg(struct ds_cont_child *cont)
struct dss_module_info *dmi = dss_get_module_info();
struct sched_req_attr attr;

sched_req_attr_init(&attr, SCHED_REQ_GC, &cont->sc_pool->spc_uuid);
sched_req_attr_init(&attr, SCHED_REQ_GC, 0, &cont->sc_pool->spc_uuid);

if (likely(!ec_agg_disabled)) {
D_ASSERT(cont->sc_ec_agg_req == NULL);
Expand Down Expand Up @@ -1277,7 +1277,7 @@ cont_destroy_wait(struct ds_pool_child *child, uuid_t co_uuid)
DP_CONT(child->spc_uuid, co_uuid));

D_ASSERT(child != NULL);
sched_req_attr_init(&attr, SCHED_REQ_FETCH, &child->spc_uuid);
sched_req_attr_init(&attr, SCHED_REQ_FETCH, 0, &child->spc_uuid);
req = sched_req_get(&attr, ABT_THREAD_NULL);
if (req == NULL) {
D_CRIT(DF_UUID"[%d]: Failed to get sched req\n",
Expand Down
10 changes: 5 additions & 5 deletions src/dtx/dtx_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ dtx_aggregation_pool(struct dss_module_info *dmi, struct dtx_batched_pool_args *
struct dtx_tls *tls = dtx_tls_get();

D_ASSERT(dbpa->dbpa_pool);
sched_req_attr_init(&attr, SCHED_REQ_GC, &dbpa->dbpa_pool->spc_uuid);
sched_req_attr_init(&attr, SCHED_REQ_GC, 0, &dbpa->dbpa_pool->spc_uuid);

while (!dss_xstream_exiting(dmi->dmi_xstream)) {
struct dtx_stat stat = { 0 };
Expand Down Expand Up @@ -585,7 +585,7 @@ dtx_aggregation_main(void *arg)
uuid_t anonym_uuid;

uuid_clear(anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, &anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, 0, &anonym_uuid);

D_ASSERT(dmi->dmi_dtx_agg_req == NULL);
dmi->dmi_dtx_agg_req = sched_req_get(&attr, ABT_THREAD_NULL);
Expand Down Expand Up @@ -705,7 +705,7 @@ dtx_batched_commit(void *arg)
uuid_t anonym_uuid;

uuid_clear(anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, &anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, 0, &anonym_uuid);

D_ASSERT(dmi->dmi_dtx_cmt_req == NULL);
dmi->dmi_dtx_cmt_req = sched_req_get(&attr, ABT_THREAD_NULL);
Expand Down Expand Up @@ -757,7 +757,7 @@ dtx_batched_commit(void *arg)
dtx_get_dbca(dbca);

D_ASSERT(dbca->dbca_cont);
sched_req_attr_init(&attr, SCHED_REQ_GC, &dbca->dbca_cont->sc_pool_uuid);
sched_req_attr_init(&attr, SCHED_REQ_GC, 0, &dbca->dbca_cont->sc_pool_uuid);
dbca->dbca_commit_req = sched_create_ult(&attr, dtx_batched_commit_one,
dbca, 0);
if (dbca->dbca_commit_req == NULL) {
Expand All @@ -781,7 +781,7 @@ dtx_batched_commit(void *arg)
dtx_get_dbca(dbca);

D_ASSERT(dbca->dbca_cont);
sched_req_attr_init(&attr, SCHED_REQ_GC, &dbca->dbca_cont->sc_pool_uuid);
sched_req_attr_init(&attr, SCHED_REQ_GC, 0, &dbca->dbca_cont->sc_pool_uuid);
dbca->dbca_cleanup_req = sched_create_ult(&attr, dtx_cleanup, dbca, 0);
if (dbca->dbca_cleanup_req == NULL) {
D_WARN("Fail to start DTX ULT (3) for "DF_UUID"\n",
Expand Down
2 changes: 1 addition & 1 deletion src/engine/drpc_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ dss_drpc_call(int32_t module, int32_t method, void *req, size_t req_size,

/* Initialize sched_req for the backoffs below. */
uuid_clear(anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, &anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, 0, &anonym_uuid);
sched_req = sched_req_get(&attr, ABT_THREAD_NULL);
if (sched_req == NULL) {
D_ERROR("failed to get sched req\n");
Expand Down
11 changes: 8 additions & 3 deletions src/engine/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,12 +746,17 @@ static inline int
req_kickoff_internal(struct dss_xstream *dx, struct sched_req_attr *attr,
void (*func)(void *), void *arg)
{
uint32_t flags = 0;

D_ASSERT(attr && func && arg);
D_ASSERT(attr->sra_type < SCHED_REQ_TYPE_MAX);

return sched_create_thread(dx, func, arg, ABT_THREAD_ATTR_NULL, NULL,
attr->sra_flags & SCHED_REQ_FL_PERIODIC ?
DSS_ULT_FL_PERIODIC : 0);
if (attr->sra_flags & SCHED_REQ_FL_PERIODIC)
flags |= DSS_ULT_FL_PERIODIC;
if (attr->sra_flags & SCHED_REQ_FL_DEEP_STACK)
flags |= DSS_ULT_DEEP_STACK;

return sched_create_thread(dx, func, arg, ABT_THREAD_ATTR_NULL, NULL, flags);
}

static int
Expand Down
2 changes: 1 addition & 1 deletion src/engine/srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ dss_sleep(uint64_t msec)
uuid_t anonym_uuid;

uuid_clear(anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, &anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, 0, &anonym_uuid);
req = sched_req_get(&attr, ABT_THREAD_NULL);
if (req == NULL)
return -DER_NOMEM;
Expand Down
16 changes: 8 additions & 8 deletions src/include/daos_srv/daos_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,11 @@ enum {
};

enum {
SCHED_REQ_FL_NO_DELAY = (1 << 0),
SCHED_REQ_FL_PERIODIC = (1 << 1),
SCHED_REQ_FL_NO_REJECT = (1 << 2),
SCHED_REQ_FL_RESENT = (1 << 3),
SCHED_REQ_FL_NO_DELAY = (1 << 0),
SCHED_REQ_FL_PERIODIC = (1 << 1),
SCHED_REQ_FL_NO_REJECT = (1 << 2),
SCHED_REQ_FL_RESENT = (1 << 3),
SCHED_REQ_FL_DEEP_STACK = (1 << 4),
};

struct sched_req_attr {
Expand All @@ -174,11 +175,10 @@ struct sched_req_attr {
};

static inline void
sched_req_attr_init(struct sched_req_attr *attr, unsigned int type,
uuid_t *pool_id)
sched_req_attr_init(struct sched_req_attr *attr, uint32_t type, uint32_t flags, uuid_t *pool_id)
{
attr->sra_type = type;
attr->sra_flags = 0;
attr->sra_type = type;
attr->sra_flags = flags;
uuid_copy(attr->sra_pool_id, *pool_id);
}

Expand Down
3 changes: 2 additions & 1 deletion src/object/srv_coll.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ obj_coll_local(crt_rpc_t *rpc, struct daos_coll_shard *shards, struct dtx_coll_e
coll_args.ca_tgt_bitmap = dce->dce_bitmap;
coll_args.ca_tgt_bitmap_sz = dce->dce_bitmap_sz;

rc = dss_thread_collective_reduce(&coll_ops, &coll_args, DSS_USE_CURRENT_ULT);
rc = dss_thread_collective_reduce(&coll_ops, &coll_args,
DSS_ULT_DEEP_STACK | DSS_USE_CURRENT_ULT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one line change is the whole purpose of this PR. Other changes looks not necessary (and not correct) to me.

BTW, due to the DSS_USE_CURRENT_ULT flag, the collective function executed on current xstream won't be able to run in deep stack. I think that's something needs be fixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one line change is the whole purpose of this PR. Other changes looks not necessary (and not correct) to me.

No, current ULT itself is also part of the collective operation, it also needs deep stack when it is created. That is the changes for others in this patch.

BTW, due to the DSS_USE_CURRENT_ULT flag, the collective function executed on current xstream won't be able to run in deep stack. I think that's something needs be fixed.

If current ULT can do the task by itself, why need to create new ULT on the same XS?


out:
if (octa.octa_versions != NULL) {
Expand Down
26 changes: 14 additions & 12 deletions src/object/srv_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,14 @@ obj_get_req_attr(crt_rpc_t *rpc, struct sched_req_attr *attr)
type = SCHED_REQ_UPDATE;
else
type = SCHED_REQ_FETCH;
sched_req_attr_init(attr, type, &orw->orw_pool_uuid);
sched_req_attr_init(attr, type, 0, &orw->orw_pool_uuid);
break;
}
case DAOS_OBJ_RPC_MIGRATE: {
struct obj_migrate_in *omi = crt_req_get(rpc);

attr->sra_enqueue_id = omi->om_comm_in.req_in_enqueue_id;
sched_req_attr_init(attr, SCHED_REQ_MIGRATE, &omi->om_pool_uuid);
sched_req_attr_init(attr, SCHED_REQ_MIGRATE, 0, &omi->om_pool_uuid);
break;
}
/*
Expand All @@ -258,7 +258,7 @@ obj_get_req_attr(crt_rpc_t *rpc, struct sched_req_attr *attr)
attr->sra_enqueue_id = oei_v10->oei_comm_in.req_in_enqueue_id;
}
type = (oei->oei_flags & ORF_FOR_MIGRATION) ? SCHED_REQ_MIGRATE : SCHED_REQ_ANONYM;
sched_req_attr_init(attr, type, &oei->oei_pool_uuid);
sched_req_attr_init(attr, type, 0, &oei->oei_pool_uuid);
break;
}
case DAOS_OBJ_RPC_PUNCH:
Expand All @@ -274,7 +274,7 @@ obj_get_req_attr(crt_rpc_t *rpc, struct sched_req_attr *attr)

attr->sra_enqueue_id = opi_v10->opi_comm_in.req_in_enqueue_id;
}
sched_req_attr_init(attr, SCHED_REQ_ANONYM, &opi->opi_pool_uuid);
sched_req_attr_init(attr, SCHED_REQ_ANONYM, 0, &opi->opi_pool_uuid);
break;
}
case DAOS_OBJ_RPC_QUERY_KEY: {
Expand All @@ -285,7 +285,7 @@ obj_get_req_attr(crt_rpc_t *rpc, struct sched_req_attr *attr)

attr->sra_enqueue_id = okqi_v10->okqi_comm_in.req_in_enqueue_id;
}
sched_req_attr_init(attr, SCHED_REQ_ANONYM, &okqi->okqi_pool_uuid);
sched_req_attr_init(attr, SCHED_REQ_ANONYM, 0, &okqi->okqi_pool_uuid);
break;
}
case DAOS_OBJ_RPC_SYNC: {
Expand All @@ -296,7 +296,7 @@ obj_get_req_attr(crt_rpc_t *rpc, struct sched_req_attr *attr)

attr->sra_enqueue_id = osi_v10->osi_comm_in.req_in_enqueue_id;
}
sched_req_attr_init(attr, SCHED_REQ_ANONYM, &osi->osi_pool_uuid);
sched_req_attr_init(attr, SCHED_REQ_ANONYM, 0, &osi->osi_pool_uuid);
break;
}
case DAOS_OBJ_RPC_KEY2ANCHOR: {
Expand All @@ -307,41 +307,43 @@ obj_get_req_attr(crt_rpc_t *rpc, struct sched_req_attr *attr)

attr->sra_enqueue_id = oki_v10->oki_comm_in.req_in_enqueue_id;
}
sched_req_attr_init(attr, SCHED_REQ_ANONYM, &oki->oki_pool_uuid);
sched_req_attr_init(attr, SCHED_REQ_ANONYM, 0, &oki->oki_pool_uuid);
break;
}
case DAOS_OBJ_RPC_EC_AGGREGATE: {
struct obj_ec_agg_in *ea = crt_req_get(rpc);

attr->sra_enqueue_id = ea->ea_comm_in.req_in_enqueue_id;
sched_req_attr_init(attr, SCHED_REQ_ANONYM, &ea->ea_pool_uuid);
sched_req_attr_init(attr, SCHED_REQ_ANONYM, 0, &ea->ea_pool_uuid);
break;
}
case DAOS_OBJ_RPC_EC_REPLICATE: {
struct obj_ec_rep_in *er = crt_req_get(rpc);

attr->sra_enqueue_id = er->er_comm_in.req_in_enqueue_id;
sched_req_attr_init(attr, SCHED_REQ_ANONYM, &er->er_pool_uuid);
sched_req_attr_init(attr, SCHED_REQ_ANONYM, 0, &er->er_pool_uuid);
break;
}
case DAOS_OBJ_RPC_CPD: {
struct obj_cpd_in *oci = crt_req_get(rpc);

sched_req_attr_init(attr, SCHED_REQ_ANONYM, &oci->oci_pool_uuid);
sched_req_attr_init(attr, SCHED_REQ_ANONYM, 0, &oci->oci_pool_uuid);
break;
}
case DAOS_OBJ_RPC_COLL_PUNCH: {
struct obj_coll_punch_in *ocpi = crt_req_get(rpc);

attr->sra_enqueue_id = ocpi->ocpi_comm_in.req_in_enqueue_id;
sched_req_attr_init(attr, SCHED_REQ_ANONYM, &ocpi->ocpi_po_uuid);
sched_req_attr_init(attr, SCHED_REQ_ANONYM, SCHED_REQ_FL_DEEP_STACK,
&ocpi->ocpi_po_uuid);
break;
}
case DAOS_OBJ_RPC_COLL_QUERY: {
struct obj_coll_query_in *ocqi = crt_req_get(rpc);

attr->sra_enqueue_id = ocqi->ocqi_comm_in.req_in_enqueue_id;
sched_req_attr_init(attr, SCHED_REQ_ANONYM, &ocqi->ocqi_po_uuid);
sched_req_attr_init(attr, SCHED_REQ_ANONYM, SCHED_REQ_FL_DEEP_STACK,
&ocqi->ocqi_po_uuid);
break;
}
default:
Expand Down
2 changes: 1 addition & 1 deletion src/pool/srv_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,7 +1630,7 @@ start_event_timer(struct event_timer_arg *arg)

D_ASSERT(events->pse_timer == NULL);
uuid_clear(uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, &uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, 0, &uuid);
events->pse_timer = sched_create_ult(&attr, event_timer, arg, 0);
if (events->pse_timer == NULL)
return -DER_NOMEM;
Expand Down
3 changes: 2 additions & 1 deletion src/pool/srv_pool_chkpt.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* (C) Copyright 2023 Intel Corporation.
* (C) Copyright 2025 Hewlett Packard Enterprise Development LP
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -242,7 +243,7 @@ ds_start_chkpt_ult(struct ds_pool_child *child)
/** We probably need something that runs with higher priority than GC but start with
* that for now.
*/
sched_req_attr_init(&attr, SCHED_REQ_GC, &child->spc_uuid);
sched_req_attr_init(&attr, SCHED_REQ_GC, 0, &child->spc_uuid);
child->spc_chkpt_req = sched_create_ult(&attr, chkpt_ult, child, DSS_DEEP_STACK_SZ);
if (child->spc_chkpt_req == NULL) {
D_ERROR(DF_UUID "[%d]: Failed to create checkpoint ULT.\n",
Expand Down
2 changes: 1 addition & 1 deletion src/pool/srv_pool_scrub_ult.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ ds_start_scrubbing_ult(struct ds_pool_child *child)
/* There will be several levels iteration, such as pool, container, object, and lower,
* and so on. Let's use DSS_DEEP_STACK_SZ to avoid ULT overflow.
*/
sched_req_attr_init(&attr, SCHED_REQ_SCRUB, &child->spc_uuid);
sched_req_attr_init(&attr, SCHED_REQ_SCRUB, 0, &child->spc_uuid);
child->spc_scrubbing_req = sched_create_ult(&attr, scrubbing_ult, child,
DSS_DEEP_STACK_SZ);
if (child->spc_scrubbing_req == NULL) {
Expand Down
6 changes: 3 additions & 3 deletions src/pool/srv_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ start_gc_ult(struct ds_pool_child *child)
D_DEBUG(DB_MGMT, DF_UUID"[%d]: starting GC ULT\n",
DP_UUID(child->spc_uuid), dmi->dmi_tgt_id);

sched_req_attr_init(&attr, SCHED_REQ_GC, &child->spc_uuid);
sched_req_attr_init(&attr, SCHED_REQ_GC, 0, &child->spc_uuid);
attr.sra_flags = SCHED_REQ_FL_NO_DELAY;

child->spc_gc_req = sched_create_ult(&attr, gc_ult, child, DSS_DEEP_STACK_SZ);
Expand Down Expand Up @@ -269,7 +269,7 @@ start_flush_ult(struct ds_pool_child *child)
D_ASSERT(child != NULL);
D_ASSERT(child->spc_flush_req == NULL);

sched_req_attr_init(&attr, SCHED_REQ_GC, &child->spc_uuid);
sched_req_attr_init(&attr, SCHED_REQ_GC, 0, &child->spc_uuid);
attr.sra_flags = SCHED_REQ_FL_NO_DELAY;

child->spc_flush_req = sched_create_ult(&attr, flush_ult, child, DSS_DEEP_STACK_SZ);
Expand Down Expand Up @@ -1226,7 +1226,7 @@ start_eph_report_ult(struct ds_pool *pool)

D_ASSERT(pool->sp_ec_ephs_req == NULL);
uuid_clear(anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, &anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, 0, &anonym_uuid);
pool->sp_ec_ephs_req = sched_create_ult(&attr, eph_report_ult, pool, DSS_DEEP_STACK_SZ);
if (pool->sp_ec_ephs_req == NULL) {
D_ERROR(DF_UUID ": Failed to create eph report ULT.\n", DP_UUID(pool->sp_uuid));
Expand Down
4 changes: 2 additions & 2 deletions src/rdb/rdb_raft.c
Original file line number Diff line number Diff line change
Expand Up @@ -2186,7 +2186,7 @@ rdb_timerd(void *arg)
D_DEBUG(DB_MD, DF_DB": timerd starting\n", DP_DB(db));

uuid_clear(anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, &anonym_uuid);
sched_req_attr_init(&attr, SCHED_REQ_ANONYM, 0, &anonym_uuid);
sched_req = sched_req_get(&attr, ABT_THREAD_NULL);
if (sched_req == NULL) {
D_ERROR(DF_DB": failed to get sched req.\n", DP_DB(db));
Expand Down Expand Up @@ -3505,4 +3505,4 @@ rdb_raft_module_init(void)
void
rdb_raft_module_fini(void)
{
}
}
6 changes: 3 additions & 3 deletions src/rebuild/srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ rebuild_leader_status_check(struct ds_pool *pool, uint32_t op,
if (rc)
return;

sched_req_attr_init(&attr, SCHED_REQ_MIGRATE, &rgt->rgt_pool_uuid);
sched_req_attr_init(&attr, SCHED_REQ_MIGRATE, 0, &rgt->rgt_pool_uuid);
rgt->rgt_ult = sched_req_get(&attr, ABT_THREAD_NULL);
if (rgt->rgt_ult == NULL)
return;
Expand Down Expand Up @@ -2777,7 +2777,7 @@ rebuild_tgt_status_check_ult(void *arg)
struct sched_req_attr attr = { 0 };

D_ASSERT(rpt != NULL);
sched_req_attr_init(&attr, SCHED_REQ_MIGRATE, &rpt->rt_pool_uuid);
sched_req_attr_init(&attr, SCHED_REQ_MIGRATE, 0, &rpt->rt_pool_uuid);
rpt->rt_ult = sched_req_get(&attr, ABT_THREAD_NULL);
if (rpt->rt_ult == NULL) {
D_ERROR("Can not start rebuild status check\n");
Expand Down Expand Up @@ -3209,7 +3209,7 @@ rebuild_get_req_attr(crt_rpc_t *rpc, struct sched_req_attr *attr)
if (opc_get(rpc->cr_opc) == REBUILD_OBJECTS_SCAN) {
struct rebuild_scan_in *rsi = crt_req_get(rpc);

sched_req_attr_init(attr, SCHED_REQ_MIGRATE, &rsi->rsi_pool_uuid);
sched_req_attr_init(attr, SCHED_REQ_MIGRATE, 0, &rsi->rsi_pool_uuid);
}

return 0;
Expand Down
Loading