thread: Inline poller_remove_timer() into thread_poll()
We already hold thehe next closest timed poller in tmp. Inlining poller_remove_timer() into thread_poll() makes the cache update more efficient. After this patch, poller_remove_timer() is called only in a single case and the case is compiled only on Linux. So add it inside of a temporary block is much clearner. However it will be used by spdk_poller_reschedule() in the end of this patch series. So keep the current position. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I2e6858223713eed84f5d70b160da6122edae6d03 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7910 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
83c197633f
commit
4eb96aeba0
@ -681,6 +681,7 @@ poller_insert_timer(struct spdk_thread *thread, struct spdk_poller *poller, uint
|
||||
thread->first_timed_poller = poller;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
static inline void
|
||||
poller_remove_timer(struct spdk_thread *thread, struct spdk_poller *poller)
|
||||
{
|
||||
@ -690,6 +691,7 @@ poller_remove_timer(struct spdk_thread *thread, struct spdk_poller *poller)
|
||||
thread->first_timed_poller = TAILQ_FIRST(&thread->timed_pollers);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
thread_insert_poller(struct spdk_thread *thread, struct spdk_poller *poller)
|
||||
@ -876,7 +878,15 @@ thread_poll(struct spdk_thread *thread, uint32_t max_msgs, uint64_t now)
|
||||
}
|
||||
|
||||
tmp = TAILQ_NEXT(poller, tailq);
|
||||
poller_remove_timer(thread, poller);
|
||||
TAILQ_REMOVE(&thread->timed_pollers, poller, tailq);
|
||||
|
||||
/* Update the cache to the next timed poller in the list
|
||||
* only if the current poller is still the closest, otherwise,
|
||||
* do nothing because the cache has been already updated.
|
||||
*/
|
||||
if (thread->first_timed_poller == poller) {
|
||||
thread->first_timed_poller = tmp;
|
||||
}
|
||||
|
||||
timer_rc = thread_execute_timed_poller(thread, poller, now);
|
||||
if (timer_rc > rc) {
|
||||
|
Loading…
Reference in New Issue
Block a user