[linux-mm-cc] /proc/swaps reports more ramzswap used than OrigDataSize?

Nitin Gupta ngupta at vflare.org
Mon Nov 9 22:58:25 EST 2009


Hi,

On Sat, Nov 7, 2009 at 12:19 PM, John McCabe-Dansted <gmatht at gmail.com> wrote:
> Hi, I have read
>  http://code.google.com/p/compcache/wiki/StatsExplained
> and I can see why OrigDataSize could be larger than the figure
> reported in /proc/swaps. However I am getting the reverse and I don't
> know why I would have a smaller OrigDataSize than the figure reported
> in /proc/swaps.
>
> From gpl2mem_150 (Attached):
>
> --
>
> Filename                                Type            Size    Used    Priority
> /dev/ramzswap0                          partition       376116  376084  100
> /dev/sdb1                               partition       2096440 54344   -1
>
> DiskSize:         376120 kB
> NumReads:           1296
> NumWrites:         94343
> FailedReads:           0
> FailedWrites:          0
> InvalidIO:             0
> NotifyFree:            0
> PagesDiscard:          0
> ZeroPages:         69734
> GoodCompress:         76 %
> NoCompress:            1 %
> PagesStored:       24295
> PagesUsed:          8658
> OrigDataSize:      97180 kB
> ComprDataSize:     33636 kB
> MemUsedTotal:      34632 kB
>

OrigDataSize should probably be renamed to "NonZeroDataSize".
Data stored in ramzswap is actually: OrigDataSize + ZeroPages*4.

So, in your case this is: 97180 + 69734*4 = 376116KB
which is less than 376084KB as reported by /proc/swaps

The reason for not adding ZeroPages when reporting OrigDataSize
is that it can give false impression of very high compressibility of memory
data.

Thanks,
Nitin


More information about the linux-mm-cc mailing list