[compiler-rt] r224522 - [Sanitizer] Fix GetRSS on Linux with non-4k pages

Kostya Serebryany kcc at google.com
Thu Dec 18 18:35:17 PST 2014


Cool, thanks!

On Thu, Dec 18, 2014 at 8:24 AM, Jay Foad <jay.foad at gmail.com> wrote:
>
> Author: foad
> Date: Thu Dec 18 10:24:01 2014
> New Revision: 224522
>
> URL: http://llvm.org/viewvc/llvm-project?rev=224522&view=rev
> Log:
> [Sanitizer] Fix GetRSS on Linux with non-4k pages
>
> Summary:
> The numbers in /proc/self/statm are in pages, not in fixed 4k units.
> This fixes Linux/hard_rss_limit_mb_test.cc on my PowerPC64 box which
> has 64k pages.
>
> Reviewers: kcc, willschm
>
> Reviewed By: willschm
>
> Subscribers: llvm-commits
>
> Differential Revision: http://reviews.llvm.org/D6717
>
> Modified:
>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc?rev=224522&r1=224521&r2=224522&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_linux.cc Thu Dec 18
> 10:24:01 2014
> @@ -432,7 +432,7 @@ uptr GetRSS() {
>    buf[len] = 0;
>    // The format of the file is:
>    // 1084 89 69 11 0 79 0
> -  // We need the second number which is RSS in 4K units.
> +  // We need the second number which is RSS in pages.
>    char *pos = buf;
>    // Skip the first number.
>    while (*pos >= '0' && *pos <= '9')
> @@ -444,7 +444,7 @@ uptr GetRSS() {
>    uptr rss = 0;
>    while (*pos >= '0' && *pos <= '9')
>      rss = rss * 10 + *pos++ - '0';
> -  return rss * 4096;
> +  return rss * GetPageSizeCached();
>  }
>
>  static void GetArgsAndEnv(char*** argv, char*** envp) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141218/86194d39/attachment.html>


More information about the llvm-commits mailing list