Commit 4eb96aeb authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

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: default avatarShuhei 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 83c19763
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -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) {