mmap/mlock performance versus read

From: Paul Barton-Davis (pbd@Op.Net)
Date: Tue Apr 04 2000 - 17:49:30 EST


Enclosed are two little test programs. They both do the following:

         * open 24 files (all the same size, about 23MB)
         * getting 256kB of data from each file into unpageable RAM
         * move along 256kB
         * release previous 256kB of unpageable data
         * repeat until we reach the end of the files

One program uses mmap/mlock to accomplish the lockdown, and calls
munmap to release the previously locked chunk.

The other locks down a malloc-ed buffer for each file, and uses read
to move the data into user space.

I was very disheartened to find that on my system the mmap/mlock
approach took *3 TIMES* as long as the read solution. It seemed to me
that mmap/mlock should be at least as fast as read. Comments are
invited.

--p

begin 664 mmrtest.gz.uu
M'XL(``=QZC@``^U7ZT_<1A#GZ_FOF!)=>C[,G>\%4DFB7._<%H4$=(>$*$66
M\8.SL->6O2Y*4_[WSJ[7QO9=@:2A5=3]??!C=M;S7L^$(753VK.WGA$#7=_;
M&\,6P&!_HHO[@-TY)OIH`K"O[P_'>Z/!WA"7]='>9`OTYU2J0)92*P'8BJ^<
M!_D>6_]&\<(G=I`Y+KQ*J>-'O=4;I4I*?')=I[E)0M;8G,"_JM,RXB.Y3O-L
M0H/&UH]I/PPMLD[%L-`ZU4K#?FQ=N^O4,$T847GAN)Y/7)B=SXZ,I7EB+,SW
M2V.&.3:>Z(B>[I4\1\>S=_/CLP_FC^>GQI+EX<GT9\-<'OYJ0!=&PY+QP^EB
M.GNWA'L,QY67DF]^N#!FI\>+\W)INT^MV.T/QSTK<:(LV584^C%VD1_0LYE-
MX9/"^'Q"P7,.^'/J_^&:^.H'KLF><ZJ]8CG:14_%YE7F>6Y2XPZ#R+XQ62+3
M#727X+?O@"86OB"#@O*4_"UU:19#1RQ!EVJYJ&YLT96J*)^4EM"4A8-?4#Q^
MHN5[T.G0W3>>`Z\ABET"';9'@V-S,3];J"J\`EU%`ULM+\8LHLB/"8'9H\&V
M;9'O:;Z+&0KM]#>RK0$7>H`[$E0K(;`[P)<[%.9QZ;DX#5X*-1@K(Q6N0D7$
M2B^EPGF<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of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Apr 07 2000 - 21:00:13 EST