merged RC_1_1 into master

This commit is contained in:
arvidn 2018-06-23 23:19:53 +02:00
commit 2cb29f88ac
3 changed files with 12 additions and 3 deletions

View File

@ -289,6 +289,12 @@ namespace aux {
~disk_io_thread();
#endif
enum
{
// every 4:th thread is a hash thread
hasher_thread_divisor = 4
};
void set_settings(settings_pack const* sett);
void abort(bool wait);

View File

@ -321,7 +321,7 @@ constexpr disk_job_flags_t disk_interface::cache_hit;
int const num_threads = m_settings.get_int(settings_pack::aio_threads);
// add one hasher thread for every three generic threads
int const num_hash_threads = num_threads / 4;
int const num_hash_threads = num_threads / hasher_thread_divisor;
m_generic_threads.set_max_threads(num_threads - num_hash_threads);
m_hash_threads.set_max_threads(num_hash_threads);
}

View File

@ -2291,8 +2291,11 @@ bool is_downloading_state(int const st)
/ m_torrent_file->piece_length();
// if we only keep a single read operation in-flight at a time, we suffer
// significant performance degradation. Always keep at least two jobs
// outstanding
if (num_outstanding < 2) num_outstanding = 2;
// outstanding per hasher thread
int const min_outstanding = 2
* std::max(1, settings().get_int(settings_pack::aio_threads)
/ disk_io_thread::hasher_thread_divisor);
if (num_outstanding < min_outstanding) num_outstanding = min_outstanding;
// we might already have some outstanding jobs, if we were paused and
// resumed quickly, before the outstanding jobs completed