[RFC PATCH 3/4] Test pidns translation cache

Dmitry V. Levin ldv at altlinux.org
Sat Aug 15 20:35:25 UTC 2020


On Sat, Aug 15, 2020 at 10:21:49PM +0200, Ákos Uzonyi wrote:
> On Sat, 15 Aug 2020 at 14:37, Dmitry V. Levin <ldv at altlinux.org> wrote:
> > On Thu, Aug 13, 2020 at 05:32:41PM +0200, Ákos Uzonyi wrote:
> > [...]
> > > +/**
> > > + * There is a 1 sec timeout for this test. With pidns caching more than 1000
> > > + * syscalls can be executed, without caching only a few tens.
> > > + */
> > > +#define SYSCALL_COUNT 200
> > > +
> > > +int
> > > +main(void)
> > > +{
> > > +     pidns_test_init();
> > > +
> > > +        for (int i = 0; i < SYSCALL_COUNT; i++)
> > > +                getpid();
> > > +
> > > +     return 0;
> > > +}
> >
> > As getpid can be easily cached by libc, this has to be a syscall().
> >
> > With regards to the number of syscalls, some hosts could be very slow, so
> > I suggest to count the number of syscalls without any pid translation and
> > use it as a baseline.
> 
> Good idea, thanks.

We employ a similar technique in filter_seccomp-perf.test where the test
counts the number of chdir syscalls invoked in a loop for one second.


-- 
ldv


More information about the Strace-devel mailing list