[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-17 Thread Kadir Cetinkaya via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rCTE349345: [clangd] Only reduce priority of a thread for indexing. (authored by kadircet, committed by ). Changed prior to commit: https://reviews.llvm.org/D55315?vs=178443&id=178445#toc Repository: r

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-17 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 178443. kadircet marked an inline comment as done. kadircet added a comment. - Revert name from Tasks to Queue Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55315/new/ https://reviews.llvm.org/D55315 Files:

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-17 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov accepted this revision. ilya-biryukov added a comment. This revision is now accepted and ready to land. LGTM Comment at: clangd/index/Background.h:121 bool ShouldStop = false; - std::deque Queue; + std::deque> Tasks; std::vector ThreadPool; // FIXME: Abstr

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-13 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 178094. kadircet marked 2 inline comments as done. kadircet added a comment. - Use std::deque instead of std::list Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55315/new/ https://reviews.llvm.org/D55315 Files

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-13 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments. Comment at: clangd/index/Background.h:121 bool ShouldStop = false; - std::deque Queue; + std::list> Tasks; std::vector ThreadPool; // FIXME: Abstract this away. ilya-biryukov wrote: > kadircet wrote: > > ilya-biryukov wrote

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/index/Background.h:121 bool ShouldStop = false; - std::deque Queue; + std::list> Tasks; std::vector ThreadPool; // FIXME: Abstract this away. kadircet wrote: > ilya-biryukov wrote: > > Why not `std::

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-13 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet marked an inline comment as done. kadircet added inline comments. Comment at: clangd/index/Background.h:121 bool ShouldStop = false; - std::deque Queue; + std::list> Tasks; std::vector ThreadPool; // FIXME: Abstract this away. ilya-biryukov wrote

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/index/Background.h:121 bool ShouldStop = false; - std::deque Queue; + std::list> Tasks; std::vector ThreadPool; // FIXME: Abstract this away. Why not `std::deque`? Repository: rCTE Clang Tools Ex

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-13 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 178052. kadircet marked 6 inline comments as done. kadircet added a comment. - Address comments Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55315/new/ https://reviews.llvm.org/D55315 Files: clangd/Threadin

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-13 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/index/Background.cpp:107 while (ThreadPoolSize--) { ThreadPool.emplace_back([this] { run(); }); } NIT: remove braces around a single statement Comment at: clangd/index/Backgroun

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-07 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 177188. kadircet marked 3 inline comments as done. kadircet added a comment. - Move priority change logic to runner - Change storage for tasks from deque to list, since we only pop from front but we might end up adding into middle. Repository: rCTE Clang

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-07 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments. Comment at: clangd/index/Background.cpp:202 std::lock_guard Lock(QueueMu); -Queue.push_back(std::move(T)); +if (Priority == ThreadPriority::Low) { + Queue.push_back(Bind( ilya-biryukov wrote: > kadircet wrote: > >

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-07 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/index/Background.cpp:202 std::lock_guard Lock(QueueMu); -Queue.push_back(std::move(T)); +if (Priority == ThreadPriority::Low) { + Queue.push_back(Bind( kadircet wrote: > ilya-biryukov wrote

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-06 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments. Comment at: clangd/index/Background.cpp:202 std::lock_guard Lock(QueueMu); -Queue.push_back(std::move(T)); +if (Priority == ThreadPriority::Low) { + Queue.push_back(Bind( ilya-biryukov wrote: > Since we might be i

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-06 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 177007. kadircet marked 2 inline comments as done. kadircet added a comment. - Delete redundant comment Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55315/new/ https://reviews.llvm.org/D55315 Files: clangd/

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-05 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/Threading.h:124 }; -void setThreadPriority(std::thread &T, ThreadPriority Priority); +// Sets scheduling priority for the calling thread. +void setCurrentThreadPriority(ThreadPriority Priority); The comment

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-05 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 176834. kadircet marked 2 inline comments as done. kadircet added a comment. - Move priority change logic into enqueueTask Repository: rCTE Clang Tools Extra CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55315/new/ https://reviews.llvm.org/D5531

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-05 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/Threading.h:125 +// Sets scheduling priority for the calling thread. +void setThreadPriority(ThreadPriority Priority); // Avoid the use of scheduler policies that may starve low-priority threads. Maybe chan

[PATCH] D55315: [clangd] Only reduce priority of a thread for indexing.

2018-12-05 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision. kadircet added a reviewer: ilya-biryukov. Herald added subscribers: cfe-commits, jfb, arphaman, jkorous, MaskRay, ioeric. We'll soon have tasks pending for reading shards from disk, we want them to have normal priority. Because: - They are not CPU intensive, mostly