[PATCH] D59130: [llvm][Support] Provide interface to set thread priorities

Dmitri Gribenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 07:21:23 PDT 2019


gribozavr added a comment.

In D59130#1424778 <https://reviews.llvm.org/D59130#1424778>, @jfb wrote:

> That doesn't answer my question though: if someone sets priority and on the platform the test witness acceptable forward progress, will it happen that another platform provide no forward progress for the same work. For example, some implementations don't let a background thread perform any I/O. In such a case, a mere logging statement would halt the background thread's progress.


Fair enough.  But is this a theoretical concern for some abstract platform that might implement this function in future, or is it a concrete concern for one of the implementations in this review?

The desired semantics for our use cases (see below) is to merely lower the CPU and I/O priority, where possible, so that heavy background work does not degrade the interactive user experience serviced by the threads in the same process.

> What threads does LLVM have that require background priority?

Source code indexing in libclang and clangd are the two use cases that we are interested in.



================
Comment at: lib/Support/Unix/Threading.inc:222
+void llvm::set_thread_priority(ThreadPriority Priority) {
+  // Some *really* old glibcs are missing SCHED_IDLE.
+#if defined(__linux__) && defined(SCHED_IDLE)
----------------
Move into the `__linux__` section.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59130/new/

https://reviews.llvm.org/D59130





More information about the llvm-commits mailing list