Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/llfio.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2021-01-02 20:33:37 +0300
committerNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com>2021-03-16 13:21:40 +0300
commit29f262d1b4d918ce1b96b8ab0536ae9fc343e6b3 (patch)
tree25e736b5b4fb80c84cfa4c5f59224c32d1706f45
parent02c1625d7d7fda0ed37c48d6aa419943cbeeebb3 (diff)
Hopefully fix failure to find libdispatch on Mac OS. Also hopefully fix test failure on Windows.
-rw-r--r--CMakeLists.txt18
-rw-r--r--include/llfio/revision.hpp6
-rw-r--r--include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp12
-rw-r--r--include/llfio/v2.0/dynamic_thread_pool_group.hpp26
4 files changed, 37 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6112775..0a82bd45 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -286,23 +286,25 @@ int main() {
endif()
# Do we have Grand Central Dispatch on this platform?
if(NOT LLFIO_DISABLE_LIBDISPATCH)
- function(check_have_libdispatch)
- set(CMAKE_REQUIRED_LIBRARIES dispatch)
+ function(check_have_libdispatch postfix)
+ set(CMAKE_REQUIRED_LIBRARIES ${ARGN})
check_cxx_source_compiles("
#include <dispatch/dispatch.h>
int main() {
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
return 0;
}
-" LLFIO_HAS_LIBDISPATCH)
+" LLFIO_HAS_LIBDISPATCH_${postfix})
endfunction()
- check_have_libdispatch()
- if(LLFIO_HAS_LIBDISPATCH)
- all_compile_definitions(PUBLIC LLFIO_FORCE_USE_LIBDISPATCH=1)
- all_link_libraries(PUBLIC dispatch)
+ check_have_libdispatch(BUILTIN)
+ if(NOT LLFIO_HAS_LIBDISPATCH_BUILTIN)
+ check_have_libdispatch(WITH_LIBDISPATCH)
+ if(LLFIO_HAS_LIBDISPATCH_WITH_LIBDISPATCH)
+ all_link_libraries(PUBLIC dispatch)
+ endif()
endif()
endif()
-if(NOT LLFIO_HAS_LIBDISPATCH AND (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE))
+if(NOT LLFIO_HAS_LIBDISPATCH_BUILTIN AND NOT LLFIO_HAS_LIBDISPATCH_WITH_LIBDISPATCH AND (CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE))
indented_message(FATAL_ERROR "FATAL: Grand Central Dispatch as libdispatch was not found on this FreeBSD or Mac OS system. libdispatch is required for LLFIO to build on those systems.")
endif()
diff --git a/include/llfio/revision.hpp b/include/llfio/revision.hpp
index 4c4d51a2..c56a2976 100644
--- a/include/llfio/revision.hpp
+++ b/include/llfio/revision.hpp
@@ -1,4 +1,4 @@
// Note the second line of this file must ALWAYS be the git SHA, third line ALWAYS the git SHA update time
-#define LLFIO_PREVIOUS_COMMIT_REF 151ca5af1030e9b0393730f33d50882ec103aac8
-#define LLFIO_PREVIOUS_COMMIT_DATE "2020-12-29 14:41:13 +00:00"
-#define LLFIO_PREVIOUS_COMMIT_UNIQUE 151ca5af
+#define LLFIO_PREVIOUS_COMMIT_REF 96bff4fddf442a2526cda850876b82c191e4030a
+#define LLFIO_PREVIOUS_COMMIT_DATE "2021-01-01 18:00:23 +00:00"
+#define LLFIO_PREVIOUS_COMMIT_UNIQUE 96bff4fd
diff --git a/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp b/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp
index d40ed3b6..57e1e525 100644
--- a/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp
+++ b/include/llfio/v2.0/detail/impl/dynamic_thread_pool_group.ipp
@@ -35,6 +35,7 @@ Distributed under the Boost Software License, Version 1.0.
#include <iostream>
+#ifndef LLFIO_DYNAMIC_THREAD_POOL_GROUP_USING_GCD
#if LLFIO_FORCE_USE_LIBDISPATCH
#include <dispatch/dispatch.h>
#define LLFIO_DYNAMIC_THREAD_POOL_GROUP_USING_GCD 1
@@ -52,6 +53,7 @@ Distributed under the Boost Software License, Version 1.0.
#endif
#endif
#endif
+#endif
LLFIO_V2_NAMESPACE_BEGIN
@@ -1039,15 +1041,11 @@ LLFIO_HEADERS_ONLY_MEMFUNC_SPEC intptr_t dynamic_thread_pool_group::io_aware_wor
i->second.average_busy = (i->second.average_busy * 0.9f) + (i->second.statfs.f_iosbusytime * 0.1f);
i->second.average_queuedepth = (i->second.average_queuedepth * 0.9f) + (i->second.statfs.f_iosinprogress * 0.1f);
}
- if(i->second.average_busy < 0.95f && i->second.average_queuedepth < 4)
+ if(i->second.average_busy < this->max_iosbusytime && i->second.average_queuedepth < this->min_iosinprogress)
{
i->second.default_deadline = std::chrono::seconds(0); // remove pacing
}
-#ifdef _WIN32
- else if(i->second.average_queuedepth > 1) // windows appears to do a lot of i/o coalescing
-#else
- else if(i->second.average_queuedepth > 32)
-#endif
+ else if(i->second.average_queuedepth > this->max_iosinprogress)
{
if(0 == i->second.default_deadline.nsecs)
{
@@ -1062,7 +1060,7 @@ LLFIO_HEADERS_ONLY_MEMFUNC_SPEC intptr_t dynamic_thread_pool_group::io_aware_wor
i->second.default_deadline.nsecs++;
}
}
- else
+ else if(i->second.average_queuedepth < this->min_iosinprogress)
{
if(i->second.default_deadline.nsecs > (i->second.default_deadline.nsecs >> 4) && (i->second.default_deadline.nsecs >> 4) > 0)
{
diff --git a/include/llfio/v2.0/dynamic_thread_pool_group.hpp b/include/llfio/v2.0/dynamic_thread_pool_group.hpp
index a511c3b5..748bd94c 100644
--- a/include/llfio/v2.0/dynamic_thread_pool_group.hpp
+++ b/include/llfio/v2.0/dynamic_thread_pool_group.hpp
@@ -308,14 +308,16 @@ public:
For seekable handles, currently `reads`, `writes` and `barriers` are ignored. We
simply retrieve, periodically, `statfs_t::f_iosinprogress` and `statfs_t::f_iosbusytime`
for the storage devices backing the seekable handle. If the recent averaged i/o wait time exceeds
- 95% and the i/o in progress > 32, `next()` will start setting the default deadline passed to
+ `max_iosbusytime` and the i/o in progress > `max_iosinprogress`, `next()` will
+ start setting the default deadline passed to
`io_aware_next()`. Thereafter, every 1/10th of a second, if `statfs_t::f_iosinprogress`
- is above 32, it will increase the deadline by 1/16th, whereas if it is
- below 32, it will decrease the deadline by 1/16th. The default deadline chosen is always the worst of all the
+ is above `max_iosinprogress`, it will increase the deadline by 1/16th, whereas if it is
+ below `min_iosinprogress`, it will decrease the deadline by 1/16th. The default deadline
+ chosen is always the worst of all the
storage devices of all the handles. This will reduce concurrency within the kernel thread pool
in order to reduce congestion on the storage devices. If at any point `statfs_t::f_iosbusytime`
- drops below 95% as averaged across one second, and `statfs_t::f_iosinprogress` drops
- below 4, the additional
+ drops below `max_iosbusytime` as averaged across one second, and `statfs_t::f_iosinprogress` drops
+ below `min_iosinprogress`, the additional
throttling is completely removed. `io_aware_next()` can ignore the default deadline
passed into it, and can set any other deadline.
@@ -328,10 +330,20 @@ public:
work item invoked with the next piece of work.
\note Non-seekable handle support is not implemented yet.
- */
+ */
class LLFIO_DECL io_aware_work_item : public work_item
{
public:
+ //! Maximum i/o busyness above which throttling is to begin.
+ float max_iosbusytime{0.95f};
+ //! Minimum i/o in progress to target if `iosbusytime` exceeded. The default of 16 suits SSDs, you want around 4 for spinning rust or NV-RAM.
+ uint32_t min_iosinprogress{16};
+ //! Maximum i/o in progress to target if `iosbusytime` exceeded. The default of 32 suits SSDs, you want around 8 for spinning rust or NV-RAM.
+#ifdef _WIN32
+ uint32_t max_iosinprogress{1}; // windows appears to do a lot of i/o coalescing
+#else
+ uint32_t max_iosinprogress{32};
+#endif
//! Information about an i/o handle this work item will use
struct io_handle_awareness
{
@@ -355,7 +367,7 @@ public:
public:
constexpr io_aware_work_item() {}
/*! \brief Constructs a work item aware of i/o done to the handles in `hs`.
-
+
Note that the `reads`, `writes` and `barriers` are normalised to proportions
out of `1.0` by this constructor, so if for example you had `reads/writes/barriers = 200/100/0`,
after normalisation those become `0.66/0.33/0.0` such that the total is `1.0`.