smp: remove gratuitous cache miss when no responses are pending

boost::lockfree::spsc_queue::push() writes the producer index even when no
data is pushed, so check whether we need to do any work beforehand.
This commit is contained in:
Avi Kivity
2015-02-17 18:00:12 +02:00
parent 1934160549
commit c1abe0e573

View File

@@ -962,8 +962,10 @@ void smp_message_queue::respond(work_item* item) {
}
void smp_message_queue::flush_response_batch() {
_completed.push(_completed_fifo.begin(), _completed_fifo.end());
_completed_fifo.clear();
if (!_completed_fifo.empty()) {
_completed.push(_completed_fifo.begin(), _completed_fifo.end());
_completed_fifo.clear();
}
}
template<size_t PrefetchCnt, typename Func>