logalloc: background reclaim: fix shares not updated by periodic timer

adjust_shares() thinks it needs to do nothing if the main loop
is running, but in reality it can only avoid waking the main loop;
it still needs to adjust the shares unconditionally. Otherwise,
the background reclaim shares can get locked into a low value.

Fix by splitting the conditional into two.
This commit is contained in:
Avi Kivity
2021-03-15 13:46:14 +02:00
parent f2ecb4617e
commit ce1b1d6ec4

View File

@@ -409,9 +409,11 @@ private:
llogger.debug("background_reclaimer::main_loop: exit");
}
void adjust_shares() {
if (_main_loop_wait && have_work()) {
if (have_work()) {
_sg.set_shares(1 + (1000 * (free_memory_threshold - memory::stats().free_memory())) / free_memory_threshold);
main_loop_wake();
if (_main_loop_wait) {
main_loop_wake();
}
}
}
public: