lib/thread: Factor out main loops of spdk_thread_poll() into a helper function
This is another preparation to extende spdk_thread_poll() to update thread stats correctly on multiple SPDK threads per CPU core configuration as an new function spdk_thread_poll_ext(). As another preparation, factor out main loops of spdk_thread_poll() to _spdk_thread_poll(). _spdk_thread_poll() will be called in spdk_thread_poll_ext() in the next patch. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Ie006359c00afc2e9b90e15f918f76cf1af0b7ce1 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1255 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Paul Luse <paul.e.luse@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>
This commit is contained in:
parent
82ef75748a
commit
a4a8080fad
@ -532,22 +532,14 @@ _spdk_thread_update_stats(struct spdk_thread *thread, uint64_t now, int rc)
|
|||||||
thread->tsc_last = now;
|
thread->tsc_last = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now)
|
_spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now)
|
||||||
{
|
{
|
||||||
uint32_t msg_count;
|
uint32_t msg_count;
|
||||||
struct spdk_thread *orig_thread;
|
|
||||||
struct spdk_poller *poller, *tmp;
|
struct spdk_poller *poller, *tmp;
|
||||||
spdk_msg_fn critical_msg;
|
spdk_msg_fn critical_msg;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
orig_thread = _get_thread();
|
|
||||||
tls_thread = thread;
|
|
||||||
|
|
||||||
if (now == 0) {
|
|
||||||
now = spdk_get_ticks();
|
|
||||||
}
|
|
||||||
|
|
||||||
critical_msg = thread->critical_msg;
|
critical_msg = thread->critical_msg;
|
||||||
if (spdk_unlikely(critical_msg != NULL)) {
|
if (spdk_unlikely(critical_msg != NULL)) {
|
||||||
critical_msg(NULL);
|
critical_msg(NULL);
|
||||||
@ -640,6 +632,24 @@ spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
spdk_thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now)
|
||||||
|
{
|
||||||
|
struct spdk_thread *orig_thread;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
orig_thread = _get_thread();
|
||||||
|
tls_thread = thread;
|
||||||
|
|
||||||
|
if (now == 0) {
|
||||||
|
now = spdk_get_ticks();
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = _spdk_thread_poll(thread, max_msgs, now);
|
||||||
|
|
||||||
_spdk_thread_update_stats(thread, now, rc);
|
_spdk_thread_update_stats(thread, now, rc);
|
||||||
|
|
||||||
tls_thread = orig_thread;
|
tls_thread = orig_thread;
|
||||||
|
Loading…
Reference in New Issue
Block a user