On Wed, 31 Jul 2019, Andy Lutomirski wrote: > On Mon, Jul 29, 2019 at 2:58 PM Dmitry Safonov <dima@xxxxxxxxxx> wrote: > > As it has been discussed on timens RFC, adding a new conditional branch > > `if (inside_time_ns)` on VDSO for all processes is undesirable. > > > > Addressing those problems, there are two versions of VDSO's .so: > > for host tasks (without any penalty) and for processes inside of time > > namespace with clk_to_ns() that subtracts offsets from host's time. > > > > The timens code in vdso looks like this: > > > > if (timens_static_branch_unlikely()) { > > clk_to_ns(clk, ts); > > } > > I'm confused. Now we effectively have *three* versions: the vDSO > without timens, and vDSO with timens but with it switched off, and the > vDSO with timens on. This seems like too much. The problem is that if you have a single VDSO, then omce one process joins a time namespace _ALL_ other processes get an extra conditional with at least one extra cache line as a bonus. This has been discussed at Plumbers last year and the agreement was to create VDSO plain (no namespace support) and VDSO extra (namespace support). The performance hit of the conditional + one etra cache line for tasks which do not use a time name space is measurable. That also avoids the whole mess of dealing with the static branch being flipped. The time name space property is determined on fork/exec _before_ anything can touch the VDSO and depending on it the approriate version of the VDSO is loaded. Thanks, tglx