mirror of
https://github.com/matrix-construct/construct
synced 2024-11-16 23:10:54 +01:00
ircd::db::prefetcher: Add yield point.
This commit is contained in:
parent
9d2e506253
commit
8e116e3578
1 changed files with 10 additions and 1 deletions
11
ircd/db.cc
11
ircd/db.cc
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue