Re: [PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-11-07 Thread Mikael Holmén via cfe-commits
On 11/7/18 11:31 AM, Sam McCall wrote: > I'll send a patch shortly to unbreak this. > > Is emitting a warning a problem for you? (i.e. do you build with -Werror) Yes "unfortunately" we use -Werror. > I'd like to do something like #ifdef SCHED_IDLE ... #else #warning "old > libc?" #endif > Tha

Re: [PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-11-07 Thread Sam McCall via cfe-commits
I'll send a patch shortly to unbreak this. Is emitting a warning a problem for you? (i.e. do you build with -Werror) I'd like to do something like #ifdef SCHED_IDLE ... #else #warning "old libc?" #endif That way if this isn't actually working we'll break in linux configurations covered by -Werror

Re: [PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-11-07 Thread Mikael Holmén via cfe-commits
Hi, On 11/7/18 11:03 AM, Sam McCall wrote: > On Wed, Nov 7, 2018 at 10:32 AM Mikael Holmén via Phabricator > mailto:revi...@reviews.llvm.org>> wrote: > > uabelho added a comment. > > Hi, > > I've got a post-review comment about the use of SCHED_IDLE vs the > needed gcc version.

Re: [PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-11-07 Thread Sam McCall via cfe-commits
On Wed, Nov 7, 2018 at 10:32 AM Mikael Holmén via Phabricator < revi...@reviews.llvm.org> wrote: > uabelho added a comment. > > Hi, > > I've got a post-review comment about the use of SCHED_IDLE vs the needed > gcc version. > > > > > Comment at: clang-tools-extra/trunk/clangd/Thre

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-11-07 Thread Mikael Holmén via Phabricator via cfe-commits
uabelho added a comment. Hi, I've got a post-review comment about the use of SCHED_IDLE vs the needed gcc version. Comment at: clang-tools-extra/trunk/clangd/Threading.cpp:110 + T.native_handle(), + Priority == ThreadPriority::Low ? SCHED_IDLE : SCHED_OTHER, &priori

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL345590: [clangd] Use thread pool for background indexing. (authored by kadircet, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D53651 Files: c

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 171676. kadircet marked an inline comment as done. kadircet added a comment. - Format the code. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53651 Files: clangd/Threading.cpp clangd/Threading.h clangd/index/Background.cpp clangd/

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 171675. kadircet marked 2 inline comments as done. kadircet added a comment. - Add comment. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53651 Files: clangd/Threading.cpp clangd/Threading.h clangd/index/Background.cpp clangd/inde

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments. Comment at: clangd/Threading.cpp:101 +void setThreadPriority(std::thread &T, ThreadPriority Priority) { +#ifdef HAVE_PTHREAD_H ilya-biryukov wrote: > Maybe put this helper into `llvm/Support/Threading.h`? We talked with Sam about

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall accepted this revision. sammccall added a comment. This revision is now accepted and ready to land. Nice! Sorry about the back and forth with threadpool... Comment at: clangd/index/Background.cpp:35 + assert(ThreadPoolSize > 0 && "Thread pool size can't be zero."); +

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 171672. kadircet added a comment. - Address comments. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53651 Files: clangd/Threading.cpp clangd/Threading.h clangd/index/Background.cpp clangd/index/Background.h Index: clangd/index/Ba

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 171658. kadircet added a comment. - Delete outdated comment. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53651 Files: clangd/Threading.cpp clangd/Threading.h clangd/index/Background.cpp clangd/index/Background.h Index: clangd/i

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added inline comments. Comment at: clangd/Threading.cpp:102 +void setThreadPriority(std::thread &T, ThreadPriority Priority) { +#ifdef HAVE_PTHREAD_H + sched_param priority; sammccall wrote: > don't you also need to actually include it? Turns out it was

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-30 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 171655. kadircet marked 14 inline comments as done. kadircet added a comment. - Address comments && Use ThreadPool Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53651 Files: clangd/Threading.cpp clangd/Threading.h clangd/index/Backg

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-30 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added inline comments. Comment at: clangd/Threading.cpp:101 +void setThreadPriority(std::thread &T, ThreadPriority Priority) { +#ifdef HAVE_PTHREAD_H Maybe put this helper into `llvm/Support/Threading.h`? Comment at: clangd/Thre

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments. Comment at: clangd/Threading.cpp:102 +void setThreadPriority(std::thread &T, ThreadPriority Priority) { +#ifdef HAVE_PTHREAD_H + sched_param priority; don't you also need to actually include it? Comment at: cla

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-29 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet updated this revision to Diff 171527. kadircet added a comment. - Use notify_all. - Use priorities. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53651 Files: clangd/Threading.cpp clangd/Threading.h clangd/index/Background.cpp clangd/index/Background.h Index:

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-29 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. Update from the offline meeting: decided to start with `llvm::ThreadPool` for background tasks and lower thread priorities for background tasks. Comment at: clangd/index/Background.cpp:89 } - QueueCV.notify_all(); + QueueCV.notify_one(); }

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-25 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet added a comment. Moving forward with priorities then. Comment at: clangd/index/Background.cpp:89 } - QueueCV.notify_all(); + QueueCV.notify_one(); } sammccall wrote: > I always forget the details of how these work :-\ > Is it possible for the "on

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-25 Thread Sam McCall via Phabricator via cfe-commits
sammccall added a comment. In https://reviews.llvm.org/D53651#1275517, @ilya-biryukov wrote: > It's fine to spend one thread spinning on background tasks, but if we're > going to do a threadpool, we should be more careful to not hurt the > performance of foreground tasks. To do that, we should

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-25 Thread Ilya Biryukov via Phabricator via cfe-commits
ilya-biryukov added a comment. It's fine to spend one thread spinning on background tasks, but if we're going to do a threadpool, we should be more careful to not hurt the performance of foreground tasks. To do that, we should at least: - share the semaphore for the number of actively running t

[PATCH] D53651: [clangd] Use thread pool for background indexing.

2018-10-24 Thread Kadir Cetinkaya via Phabricator via cfe-commits
kadircet created this revision. kadircet added reviewers: sammccall, ioeric. Herald added subscribers: cfe-commits, jfb, arphaman, jkorous, MaskRay, ilya-biryukov. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D53651 Files: clangd/index/Background.cpp clangd/index/Background