From: Andy Lutomirski Subject: Re: [PATCHv6 23/36] x86/vdso: Allocate timens vdso Date: Fri, 16 Aug 2019 08:23:07 -0700 Message-ID: References: <20190815163836.2927-1-dima@arista.com> <20190815163836.2927-24-dima@arista.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190815163836.2927-24-dima@arista.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Dmitry Safonov , linux-kernel@vger.kernel.org Cc: Dmitry Safonov <0x7f454c46@gmail.com>, 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 , Thomas Gleixner , Vincenzo Frascino , containers@lists.linux-foundation.org, criu@openvz.org, linux-api@vger.kernel.org, x86@kernel.org List-Id: linux-api@vger.kernel.org On 8/15/19 9:38 AM, 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. > It will add a penalty for everybody as branch predictor may mispredict > the jump. Also there are instruction cache lines wasted on cmp/jmp. > > Those effects of introducing time namespace are very much unwanted > having in mind how much work have been spent on micro-optimisation > vdso code. > > The propose is to allocate a second vdso code with dynamically > patched out (disabled by static_branch) timens code on boot time. > > Allocate another vdso and copy original code. I'm unconvinced that any of this magic is wise. I think you should make a special timens vvar page that causes the normal fastpath to fail (using a special vclock mode, a special seq value, or a special "last" value) and then make the failure path detect that timens is in use and use the timens path. --Andy