[linux-mm-cc] Questions about MemLimit

Nitin Gupta nitingupta910 at gmail.com
Mon Jul 20 23:39:05 EDT 2009


Hi,

On 07/20/2009 06:22 PM, Clemens Eisserer wrote:
> I have some troubles understanding the various parameters compcache provides.
> My machine is equipped with 512MB memory, and I would like to dedicate
> 200-250mb to compcache, so I set memLimit to 200mb.
> Am I right that memlimit means the maximum size compcache may allocate
> from main memory?
>    

MemLimit is upper limit on amount of compressed data that can be store in
RAM (i.e. ComprDataSize). This ComprDataSize can never exceed MemLimit.
However, due to memory allocator metadata overhead and fragmentation, we
use slightly more space than amount of compressed data.

So, for e.g., in your case:

>  MemLimit:         200000 kB

>  OrigDataSize:     306472 kB
>  ComprDataSize:     84272 kB
>  MemUsedTotal:      87124 kB


306472K compressed to 84272K. This ComprDataSize can never exceed 
MemLimit (200000 in this case).
ComprDataSize + memory allocator metadata overhead + fragmentation == 
MemUsedTotal.

At any time you can calculate waste due to allocator overhead as:
(MemUsedTotal - ComprDataSize) / ComprDataSize * 100
For your case, its ~3.3%


> What I don't understand is why OrigDataSize seems to be more or less
> fixed at about 300mb, and why only 87mb of memory actually seem to be
> used, although I set memlimit to 200mb.
>    

Firstly, I think you are using a backing swap since MemLimit stat is 
visible. However,
you removed last two lines given BDevNum{Reads,Writes} stats. Including 
these stats
in this output would have been useful.

Now, OrigDataSize staying constant suggests than all further writes seem 
to be going
to backing swap device. This happens when either ComprDataSize reaches 
MemLimit
or when incompressible pages are found.

> Even when I start many applications those values won't change much,
> although the machine already starts to swap a lot (to physical
> harddisk).
>
>    

Looks like there are some incompressible pages (compressed length > 
PAGE_SIZE/2) that
are continuously being written to physical disk (backing swap).
'GoodCompress' stat is currently useless when backing swap is used since 
only highly
compressible pages are kept in RAM in this case. So, it stays at 100%. I 
need to fix this
stat for backing swap case...

> DiskSize:         489982 kB
> MemLimit:         200000 kB
> NumReads:         407175
> NumWrites:        364944
> FailedReads:           0
> FailedWrites:          0
> InvalidIO:             0
> PagesDiscard:          0
> ZeroPages:          9852
> GoodCompress:        100 %
> NoCompress:            0 %
> PagesStored:       76618
> PagesUsed:         21781
> OrigDataSize:     306472 kB
> ComprDataSize:     84272 kB
> MemUsedTotal:      87124 kB
>    

Nitin



More information about the linux-mm-cc mailing list