[PATCH] D93726: [clangd] Use atomics instead of locks to track periodic memory trimming

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 22 12:36:53 PST 2020


sammccall created this revision.
sammccall added a reviewer: qchateau.
Herald added subscribers: usaxena95, kadircet, jfb, arphaman.
sammccall requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang.

Instead of always locking/unlocking a contended mutex, we now do one atomic read
in the common case, and one read + one exchange if the timer has expried.

Also use this for memory profiling which has similar/compatible requirements.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93726

Files:
  clang-tools-extra/clangd/ClangdLSPServer.cpp
  clang-tools-extra/clangd/ClangdLSPServer.h
  clang-tools-extra/clangd/support/Threading.cpp
  clang-tools-extra/clangd/support/Threading.h
  clang-tools-extra/clangd/unittests/support/ThreadingTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93726.313413.patch
Type: text/x-patch
Size: 7391 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201222/29eee43f/attachment.bin>


More information about the cfe-commits mailing list