[all-commits] [llvm/llvm-project] 9902a0: Add ThreadPriority::Low, and use QoS class Utility...
Sam McCall via All-commits
all-commits at lists.llvm.org
Mon May 16 01:02:11 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 9902a0945d22cd5757b16ebe85fe07059723aa09
https://github.com/llvm/llvm-project/commit/9902a0945d22cd5757b16ebe85fe07059723aa09
Author: stk <stk at ableton.com>
Date: 2022-05-16 (Mon, 16 May 2022)
Changed paths:
M clang-tools-extra/clangd/index/Background.h
M clang/tools/libclang/CIndex.cpp
M llvm/include/llvm/Support/Threading.h
M llvm/lib/Support/Unix/Threading.inc
M llvm/lib/Support/Windows/Threading.inc
Log Message:
-----------
Add ThreadPriority::Low, and use QoS class Utility on Mac
On Apple Silicon Macs, using a Darwin thread priority of PRIO_DARWIN_BG seems to
map directly to the QoS class Background. With this priority, the thread is
confined to efficiency cores only, which makes background indexing take forever.
Introduce a new ThreadPriority "Low" that sits in the middle between Background
and Default, and maps to QoS class "Utility" on Mac. Make this new priority the
default for indexing. This makes the thread run on all cores, but still lowers
priority enough to keep the machine responsive, and not interfere with
user-initiated actions.
I didn't change the implementations for Windows and Linux; on these systems,
both ThreadPriority::Background and ThreadPriority::Low map to the same thread
priority. This could be changed as a followup (e.g. by using SCHED_BATCH for Low
on Linux).
See also https://github.com/clangd/clangd/issues/1119.
Reviewed By: sammccall, dgoldman
Differential Revision: https://reviews.llvm.org/D124715
More information about the All-commits
mailing list