Skip to content

Commit

Permalink
Merge pull request #18873 from mckellyln/swapfree_fix
Browse files Browse the repository at this point in the history
HPCC-32234 SYS: swap and mem util stats sometimes invalid on containers

Reviewed-by: Gavin Halliday <[email protected]>
Merged-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday authored Jul 16, 2024
2 parents 58924f3 + 3225279 commit c5e22ef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion system/jlib/jdebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,13 @@ static void getMemUsage(unsigned &inuse,unsigned &active,unsigned &total,unsigne
bufptr = strchr(bufptr, '\n');
}
inuse = total-free-cached;
swapinuse = swaptotal-swapfree-swapcached;

// not sure if a bug in kernel or container or ...
// but sometimes we see swapfree > 0 when swaptotal == 0
if ((swapfree + swapcached) >= swaptotal)
swapinuse = 0;
else
swapinuse = swaptotal-swapfree-swapcached;
#endif
}

Expand Down

0 comments on commit c5e22ef

Please sign in to comment.