0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-09-29 04:08:54 +02:00

ircd::db::prefetcher: Add yield point.

This commit is contained in:
Jason Volk 2019-09-18 20:29:18 -07:00
parent 9d2e506253
commit 8e116e3578

View file

@ -3866,7 +3866,6 @@ ircd::db::prefetcher::operator()(column &c,
return false; return false;
} }
const ctx::critical_assertion ca;
queue.emplace_back(d, c, key); queue.emplace_back(d, c, key);
queue.back().snd = now<steady_point>(); queue.back().snd = now<steady_point>();
++request_counter; ++request_counter;
@ -3879,9 +3878,19 @@ ircd::db::prefetcher::operator()(column &c,
if(db::request.wouldblock()) if(db::request.wouldblock())
{ {
dock.notify_one(); dock.notify_one();
// If the user sets NO_BLOCKING we honor their request to not
// context switch for a prefetch. However by default we want to
// control queue growth, so we insert voluntary yield here to allow
// prefetch operations to at least be processed before returning to
// the user submitting more prefetches.
if(likely(!test(opts, db::get::NO_BLOCKING)))
ctx::yield();
return true; return true;
} }
const ctx::critical_assertion ca;
++directs_counter; ++directs_counter;
this->handle(); this->handle();
return true; return true;