event: Add lw_thread helper functions required for scheduler
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com> Change-Id: Ifd21adad6116d75170d5a6ff4b6d03470644feab Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4338 Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
2a146cd936
commit
0d8a4af849
@ -248,6 +248,24 @@ static void __attribute__((constructor)) _spdk_scheduler_register_##name(void) \
|
||||
spdk_scheduler_list_add(scheduler); \
|
||||
} \
|
||||
|
||||
/**
|
||||
* Set new CPU core index. Used for scheduling, assigns new CPU core index and marks it =
|
||||
* for rescheduling - does not actually change it. Can be used with SPDK_ENV_LCORE_ID_ANY
|
||||
*
|
||||
* \param thread thread to change core.
|
||||
* \param lcore new CPU core index.
|
||||
*/
|
||||
void _spdk_lw_thread_set_core(struct spdk_lw_thread *thread, uint32_t lcore);
|
||||
|
||||
/**
|
||||
* Get threads stats
|
||||
*
|
||||
* \param thread thread that stats regards to.
|
||||
* \param stats Output parameter for accumulated TSC counts while the thread was busy.
|
||||
*/
|
||||
void _spdk_lw_thread_get_current_stats(struct spdk_lw_thread *thread,
|
||||
struct spdk_thread_stats *stats);
|
||||
|
||||
/**
|
||||
* \brief Register a new subsystem
|
||||
*/
|
||||
|
@ -738,10 +738,7 @@ _reactor_request_thread_reschedule(struct spdk_thread *thread)
|
||||
|
||||
lw_thread = spdk_thread_get_ctx(thread);
|
||||
|
||||
assert(lw_thread != NULL);
|
||||
|
||||
lw_thread->resched = true;
|
||||
lw_thread->lcore = SPDK_ENV_LCORE_ID_ANY;
|
||||
_spdk_lw_thread_set_core(lw_thread, SPDK_ENV_LCORE_ID_ANY);
|
||||
|
||||
current_core = spdk_env_get_current_core();
|
||||
reactor = spdk_reactor_get(current_core);
|
||||
@ -942,4 +939,19 @@ reactor_interrupt_fini(struct spdk_reactor *reactor)
|
||||
reactor->fgrp = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_spdk_lw_thread_set_core(struct spdk_lw_thread *thread, uint32_t lcore)
|
||||
{
|
||||
assert(thread != NULL);
|
||||
thread->lcore = lcore;
|
||||
thread->resched = true;
|
||||
}
|
||||
|
||||
void
|
||||
_spdk_lw_thread_get_current_stats(struct spdk_lw_thread *thread, struct spdk_thread_stats *stats)
|
||||
{
|
||||
assert(thread != NULL);
|
||||
*stats = thread->current_stats;
|
||||
}
|
||||
|
||||
SPDK_LOG_REGISTER_COMPONENT(reactor)
|
||||
|
Loading…
Reference in New Issue
Block a user