aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorEvan Klitzke <evan@eklitzke.org>2018-03-06 12:50:20 -0500
committerEvan Klitzke <evan@eklitzke.org>2018-03-26 15:59:41 -0700
commitd54874d795a523d7cad5f4a9f4270145e56238f8 (patch)
treef39d91af0b1506f87c94c75aebf8e901530c70bc /src/util.h
parent0a018431c447bbf18bdaa6a1037aad6a87c1294a (diff)
Set SCHED_BATCH priority on the loadblk thread.
While reading another PR I saw a mention of #6358. The use case for SCHED_BATCH is to hint to the kernel that the thread is running a non-interactive workload that consumes a lot of CPU time. This is helpful on desktop machines where the loadblk thread can interfere with interactive applications. More details can be found in the sched(7) man page.
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 04ff44f218..a9f64a0566 100644
--- a/src/util.h
+++ b/src/util.h
@@ -357,4 +357,13 @@ std::unique_ptr<T> MakeUnique(Args&&... args)
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
+/**
+ * On platforms that support it, tell the kernel the calling thread is
+ * CPU-intensive and non-interactive. See SCHED_BATCH in sched(7) for details.
+ *
+ * @return The return value of sched_setschedule(), or 1 on systems without
+ * sched_setchedule().
+ */
+int ScheduleBatchPriority(void);
+
#endif // BITCOIN_UTIL_H