[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACVxJT9jWVzXFDZycYGvCPP0GJKgpA1g1u9rrpTeQQPaYNj+eA@mail.gmail.com>
Date: Wed, 6 Sep 2017 11:55:30 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Tatsiana Brouka <Tatsiana_Brouka@...m.com>,
linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
Aliaksandr Patseyenak <Aliaksandr_Patseyenak1@...m.com>
Subject: Re: [PATCH 1/2] pidmap(2)
On 9/6/17, Andrew Morton <akpm@...ux-foundation.org> wrote:
> On Tue, 5 Sep 2017 22:05:00 +0300 Alexey Dobriyan <adobriyan@...il.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.
View attachment "b-pidmap.c" of type "text/x-csrc" (1087 bytes)
View attachment "b-fdmap.c" of type "text/x-csrc" (823 bytes)
Powered by blists - more mailing lists