On 05/04/2018 05:03, Mark Millard wrote: > I've classically seen things like (picking on java here): > (no patch yet, so SWAP 0K shows) > > PID USERNAME THR PRI NICE SIZE RES SWAP STATE C TIME CPU COMMAND > 78694 root 44 52 0 14779M 92720K 0K uwait 22 0:06 9.91% [java] > > when Swap: . . . 0 Used . . . (or some figure much > smaller than SIZE-RES) showed. (SIZE is ki_size and > RES is ki_rssize as I remember.) It suggests some > form of reserved-but-not-allocated contribution to > ki_size (SIZE), space not resident nor swapped out > to a swap partition. Possibly vnode-backed (potential > "VN PAGER in and out" contributions instead of "SWAP > PAGER" ones, in systat -vmstat terms)? > > Are such cases examples of what you were counting > as "wildly inaccurate"? Or do you count vnode-backed > but not resident as perfectly good examples of SWAP > in use? Apologies, but I didn't quite get your question... Instead, I think I now understand better what top actually reports. I think that it reports swap usage based on the archaic swapout algorithm where a whole process is moved to swap when a memory shortage arises. And then the process can be gradually swapped in. So, ki_swrss - ki_rssize is an estimate of how much process's memory still left in swap (the difference between the resident size before the full swapout and the current resident size). Of course, now we have the modern swapout where individual inactive dirty anonymous pages can be paged out to swap (the classic whole-process swapout still can happen, but is quite rare), but top is not aware of that. -- Andriy GaponReceived on Thu Apr 05 2018 - 07:09:59 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:15 UTC