• Pavel Emelyanov's avatar
    proc_parse: Set bigger buffer for smaps FILE · 95c2a4d6
    Pavel Emelyanov authored
    We spend a lot of time reading the /proc/$pid/smaps file. The time
    is spent in two places:
    
    1 kernel puts too many info into it
    2 fgets pulls info in 1024-bytes chunks, info about one vma is
      typically bigger (up to 3k bytes) thus we call read() ~3 times
      per one vma, which increases the amount of time spent in kernel
      to re-fill this info
    
    Setting the internal buffer to PAGE_SIZE size reduces the amount of
    read()-s on ~60% during basic container dump. Setting bigger buffer
    doesn't work, as kernel's seq file engine feeds at most one page of
    data per read syscall regardless of the buffer size.
    Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
    Acked-by: 's avatarAndrew Vagin <avagin@parallels.com>
    95c2a4d6
proc_parse.c 28.4 KB