[RFC PATCH 3/4] Test pidns translation cache

Ákos Uzonyi uzonyi.akos at gmail.com
Sat Aug 15 20:21:49 UTC 2020


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.


More information about the Strace-devel mailing list