Re: [PATCHv7 00/33] kernel: Introduce Time Namespace
From: Andrei Vagin
Date: Tue Oct 22 2019 - 04:45:31 EST
On Thu, Oct 17, 2019 at 04:47:48PM -0700, Andrei Vagin wrote:
>
> In my table, the "before" column is actually for the upstream kernel
> with the 18-th patch. Here is the table with the real "before" column:
>
> | before | with 18/33 | CONFIG_TIME_NS=n | host | inside timens
> ------------------------------------------------------------------------------
> avg | 150331408 | 153345935 | 153588088 | 150816637 | 139192114
> ------------------------------------------------------------------------------
> diff % | 98 | 100 | 100.1 | 98.3 | 90.7
> ------------------------------------------------------------------------------
> stdev % | 0.3 | 0.09 | 0.15 | 0.25 | 0.13
>
> If we compare numbers in "before", "host" and "inside timens" columns, we
> see the same results that you had. clock_gettime() works with the
> same performance in the host namespace and 7% slower in a time
> namespace.
>
I played with this a bit more and I've found that we can speed up
clock_gettime on 5% more if we mark do_hres and do_coarse as
__always_inline.
With the unlikely hint in vdso_read_begin and noinline for
do_hres_timens and do_coarse_timens:
1..8
ok 1 host: clock: monotonic cycles: 155278332
ok 2 host: clock: monotonic-coarse cycles: 662067077
ok 3 host: clock: monotonic-raw cycles: 151218057
ok 4 host: clock: boottime cycles: 154907635
ok 5 ns: clock: monotonic cycles: 133100433
ok 6 host: clock: monotonic-coarse cycles: 444170219
ok 7 host: clock: monotonic-raw cycles: 129550178
ok 8 ns: clock: boottime cycles: 130167136
With __always_inline for do_hres and do_coarse:
1..8
ok 1 host: clock: monotonic cycles: 163691015
ok 2 host: clock: monotonic-coarse cycles: 641443397
ok 3 host: clock: monotonic-raw cycles: 163649270
ok 4 host: clock: boottime cycles: 163682242
ok 5 ns: clock: monotonic cycles: 138759212
ok 6 host: clock: monotonic-coarse cycles: 486149502
ok 7 host: clock: monotonic-raw cycles: 134801053
ok 8 ns: clock: boottime cycles: 138675460
# Pass 8 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0
With __always_inline for do_hres, do_coarse, do_hres_timens,
do_coarse_timens:
1..8
ok 1 host: clock: monotonic cycles: 158984538
ok 2 host: clock: monotonic-coarse cycles: 594932695
ok 3 host: clock: monotonic-raw cycles: 157834511
ok 4 host: clock: boottime cycles: 158297691
ok 5 ns: clock: monotonic cycles: 148559612
ok 6 host: clock: monotonic-coarse cycles: 468505657
ok 7 host: clock: monotonic-raw cycles: 146366575
ok 8 ns: clock: boottime cycles: 148573015
# Pass 8 Fail 0 Xfail 0 Xpass 0 Skip 0 Error 0
Thanks,
Andrei