Writing via mmap seems suboptimal

From: Mikhail Teterin <mi+mx_at_aldan.algebra.com>
Date: Tue, 13 Jun 2006 16:46:06 -0400
Hello!

My program mmaps its output and begins to (slowly) fill it up. I expected the 
kernel to flush the output at its leisure thus freeing me from trying to pick 
the best time to do so explicitly (impossible to do anyway).

Unfortunately, it appears, the kernel is instead waiting for the available 
memory to fill up and then stalls my program for over a second, while it 
flushes the entire buffer. When this happens, systat -vm looks like:

   10 users    Load  0.85  1.18  1.21                  13 чер 16:20

Mem:KB    REAL            VIRTUAL                     VN PAGER  SWAP PAGER
        Tot   Share      Tot    Share    Free         in  out     in  out
Act 1871416    2256  9145304    41244   70380 count        79
All 1913812    2384 1493309k    56528         pages      1261
                                                                 Interrupts
Proc:r  p  d  s  w    Csw  Trp  Sys  Int  Sof  Flt        cow    2593 total
        1  8 90      4599    5  505 3049    2      262996 wire        1: atkb
                                                  1392396 act         6: fdc0
 4.5%Sys   0.4%Intr  0.0%User  0.0%Nice 95.1%Idl   193448 inact       15: ata
|    |    |    |    |    |    |    |    |    |      67416 cache       17: fwo
==                                                   2964 free        20: nve
                                                          daefr       21: ohc
Namei         Name-cache    Dir-cache                     prcfr       22: ehc
    Calls     hits    %     hits    %                     react   505 25: em0
      824      824  100                                   pdwak    88 29: amr
                                          zfod            pdpgs  2000 cpu0: 
time
Disks   ad4   ad6 amrd0                   ozfod           intrn
KB/t   0.00  0.00   128                   %slo-z   221184 buf
tps       0     0    50               493 tfree       808 dirtybuf
MB/s   0.00  0.00  6.22                            100000 desiredvnodes
% busy    0     0    99                             27349 numvnodes

Any hope to see this improved? After mmap-ing the input I even use madvise to 
tell the kernel, that the memory will be accessed sequentionally, but it 
seems to ignore the hint...

Thanks!

	-mi
Received on Tue Jun 13 2006 - 18:46:32 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:57 UTC