[PATCH] D40038: [scudo] Soft and hard RSS limit checks

Aleksey Shlyapnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 14:15:46 PST 2017


alekseyshl added inline comments.


================
Comment at: lib/scudo/scudo_allocator.cpp:318
+      return atomic_load_relaxed(&RssLimitExceeded);
+    const uptr CurrentRssMb = GetRSS() >> 20;
+    if (HardRssLimitMb && HardRssLimitMb < CurrentRssMb) {
----------------
cryptoad wrote:
> cryptoad wrote:
> > alekseyshl wrote:
> > > How fast is it? It might read a file, right?
> > It either reads `/proc/self/statm`, or falls back to `getrusage` if statm is not allowed.
> > So yes, not the fastest of code paths.
> > I am not sure I see a way around it though.
> Also the common flag is called `can_use_proc_maps_statm`, which is misdirecting, I think it really should be `can_use_proc_self_statm`.
Do not fall back to reading proc/self/statm, for example? Reading a file might cause unpredictable delays, right? Not too great for the allocator. Maybe increase the interval to 1s?

Also the general idea does not feel right, the allocator is one of the moving parts affecting RSS, not the only part, why should it be burdened with RSS check?

But yeah, I have questions, but not answers, no good solution either.


https://reviews.llvm.org/D40038





More information about the llvm-commits mailing list