Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1727245

Re: [PATCH 1/2] pidmap(2)

From Alexey Dobriyan <adobriyan@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] pidmap(2)
Date 2017-09-06 11:00 +0200
Message-ID <umElH-7Em-11@gated-at.bofh.it> (permalink)
References <umrou-6Vh-17@gated-at.bofh.it> <umuZ3-IG-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On 9/6/17, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Tue, 5 Sep 2017 22:05:00 +0300 Alexey Dobriyan <adobriyan@gmail.com>
> wrote:
>
>> Implement system call for bulk retrieveing of pids in binary form.
>>
>> Using /proc is slower than necessary: 3 syscalls + another 3 for each
>> thread +
>> converting with atoi().
>>
>> /proc may be not mounted especially in containers. Natural extension of
>> hidepid=2 efforts is to not mount /proc at all.
>>
>> It could be used by programs like ps, top or CRIU. Speed increase will
>> become more drastic once combined with bulk retrieval of process
>> statistics.
>
> The patches are performance optimizations, but their changelogs contain
> no performance measurements!
>
> Demonstration of some compelling real-world performance benefits would
> help things along a lot.

I forgot the sheet with numbers at work. :^)
They're very embarrassing for /proc.

pidmap:
N=1<<16 times
~130 processes (~250 task_structs) on a regular desktop system
opendir + readdir + closedir /proc + the same for every /proc/$PID/task
(roughly what htop(1) does) vs pidmap

/proc 16.80+-0.73%
pidmap 0.06+-0.31%

fdmap:
N=1<<22 times
4 opened descriptors (0, 1, 2, 3)
opendir+readdir+closedir /proc/self/fd (lsof(1)) vs fdmap

/proc 8.31+-0.37%
fdmap 0.32+-0.72%

Currently performance improvements may not be huge or even visible.
That's because programs like ps/top/lsof _have_ to use /proc to retrieve
other information. If combined with bulk taskstats-ish retrieval interfaces
they should run around /proc.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] pidmap(2) Alexey Dobriyan <adobriyan@gmail.com> - 2017-09-05 21:10 +0200
  Re: [PATCH 1/2] pidmap(2) Andrew Morton <akpm@linux-foundation.org> - 2017-09-06 01:00 +0200
    Re: [PATCH 1/2] pidmap(2) Randy Dunlap <rdunlap@infradead.org> - 2017-09-06 01:10 +0200
      Re: [PATCH 1/2] pidmap(2) Thomas Gleixner <tglx@linutronix.de> - 2017-09-06 10:40 +0200
      Re: [PATCH 1/2] pidmap(2) Alexey Dobriyan <adobriyan@gmail.com> - 2017-09-06 11:10 +0200
        Re: [PATCH 1/2] pidmap(2) Andy Lutomirski <luto@amacapital.net> - 2017-09-07 04:10 +0200
          Re: [PATCH 1/2] pidmap(2) Djalal Harouni <tixxdz@gmail.com> - 2017-09-07 07:10 +0200
            Re: [PATCH 1/2] pidmap(2) Alexey Dobriyan <adobriyan@gmail.com> - 2017-09-07 11:50 +0200
          Re: [PATCH 1/2] pidmap(2) Alexey Dobriyan <adobriyan@gmail.com> - 2017-09-07 11:50 +0200
    Re: [PATCH 1/2] pidmap(2) Alexey Dobriyan <adobriyan@gmail.com> - 2017-09-06 11:00 +0200
  Re: [PATCH 1/2] pidmap(2) "Dmitry V. Levin" <ldv@altlinux.org> - 2017-09-07 12:10 +0200

csiph-web