Re: MMAP Buffers

Radosław Smogura <rsmogura@softperience.eu>

From: Radosław Smogura <rsmogura@softperience.eu>
To: Andres Freund <andres@anarazel.de>
Cc: pgsql-hackers@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter_e@gmx.net>, Greg Stark <gsstark@mit.edu>, Robert Haas <robertmhaas@gmail.com>, Greg Smith <greg@2ndquadrant.com>, Joshua Berkus <josh@agliodbs.com>, Andrew Dunstan <andrew@dunslane.net>, Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
Date: 2011-04-17T20:09:24Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> Sunday 17 April 2011 20:02:11
> On Sunday 17 April 2011 19:26:31 Radosław Smogura wrote:
> > Kernel merges vm_structs. So mappings are compacted. I'm not kernel
> > specialist, but skipping memory consumption, for not compacted mappings,
> > kernel uses btrees for dealing with  TLB, so it should not matter if
> > there is  100 vm_structs or 100000 vm_structs.
> 
> But the CPUs TLB cache has maybe 16/256 (1lvl, 2nd) to 64/512 entries. That
> will mean that there will be cachemisses all over.
> Additionally your scheme requires flushing it regularly...
> 
> Andres

I only know Phenom has 4096 entries I think and this covers 16MB of memory. 
But I was taking about memory usage of struct vm_struct in kernel. I tries as 
well with huge pages, but I can't write really fast allocator for this, it's 
slower then malloc, maybe from different reasons.

Regards,
Radek