From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Gleixner Subject: Re: [PATCHv5 28/37] x86/vdso: Enable static branches for the timens vdso Date: Thu, 1 Aug 2019 08:48:10 +0200 (CEST) Message-ID: References: <20190729215758.28405-1-dima@arista.com> <20190729215758.28405-29-dima@arista.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Andy Lutomirski Cc: Dmitry Safonov , LKML , Dmitry Safonov <0x7f454c46@gmail.com>, Andrei Vagin , Adrian Reber , Andrei Vagin , Arnd Bergmann , Christian Brauner , Cyrill Gorcunov , "Eric W. Biederman" , "H. Peter Anvin" , Ingo Molnar , Jann Horn , Jeff Dike , Oleg Nesterov , Pavel Emelyanov , Shuah Khan , Vincenzo Frascino , Linux Containers , criu@openvz.org, Linux API List-Id: linux-api@vger.kernel.org On Wed, 31 Jul 2019, Andy Lutomirski wrote: > On Mon, Jul 29, 2019 at 2:58 PM Dmitry Safonov 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