From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: Simplfying copy_siginfo_to_user Date: Mon, 24 Jul 2017 10:43:34 -0700 Message-ID: References: <87o9shg7t7.fsf_-_@xmission.com> <20170718140651.15973-7-ebiederm@xmission.com> <878tjlbqpt.fsf@xmission.com> <8760ek5ics.fsf_-_@xmission.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <8760ek5ics.fsf_-_-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: "Eric W. Biederman" Cc: "linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Andrei Vagin , Greg KH , Linux Containers , Pavel Emelyanov , Oleg Nesterov , Linux Kernel Mailing List , Al Viro , Andy Lutomirski , Linux API , Cyrill Gorcunov , Michael Kerrisk , Thomas Gleixner , Willy Tarreau , Andrey Vagin List-Id: linux-arch.vger.kernel.org On Sat, Jul 22, 2017 at 1:25 PM, Eric W. Biederman wrote: > I played with some clever changes such as limiting the copy to 48 bytes, > disabling the memset and the like but I could not get a strong enough > signal to say that any one change removed the extra or a clear part of > it 20ns. What CPU did you use? Because the SMAP bit in particular matters. The field-by-field copies are extremely slow on modern CPU's that implement SMAP, unless you also use the special "unsafe_put_user()" code (or the nasty old put_user_ex() code that some of the x86 signal code uses). So one of the advantages of just copy_to_user() ends up being visible only on Broadwell+ (or whatever the SMAP cutoff is). Linus From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f65.google.com ([209.85.218.65]:35120 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754175AbdGXRng (ORCPT ); Mon, 24 Jul 2017 13:43:36 -0400 MIME-Version: 1.0 In-Reply-To: <8760ek5ics.fsf_-_@xmission.com> References: <87o9shg7t7.fsf_-_@xmission.com> <20170718140651.15973-7-ebiederm@xmission.com> <878tjlbqpt.fsf@xmission.com> <8760ek5ics.fsf_-_@xmission.com> From: Linus Torvalds Date: Mon, 24 Jul 2017 10:43:34 -0700 Message-ID: Subject: Re: Simplfying copy_siginfo_to_user Content-Type: text/plain; charset="UTF-8" Sender: linux-arch-owner@vger.kernel.org List-ID: To: "Eric W. Biederman" Cc: Linux Kernel Mailing List , Andy Lutomirski , Al Viro , Oleg Nesterov , Andrei Vagin , Thomas Gleixner , Greg KH , Andrey Vagin , Serge Hallyn , Pavel Emelyanov , Cyrill Gorcunov , Peter Zijlstra , Willy Tarreau , "linux-arch@vger.kernel.org" , Linux API , Linux Containers , Michael Kerrisk Message-ID: <20170724174334.wWg2qJVwA1q1GuPaPkisy98PUu-mhSQon_8ehWPiDrY@z> On Sat, Jul 22, 2017 at 1:25 PM, Eric W. Biederman wrote: > I played with some clever changes such as limiting the copy to 48 bytes, > disabling the memset and the like but I could not get a strong enough > signal to say that any one change removed the extra or a clear part of > it 20ns. What CPU did you use? Because the SMAP bit in particular matters. The field-by-field copies are extremely slow on modern CPU's that implement SMAP, unless you also use the special "unsafe_put_user()" code (or the nasty old put_user_ex() code that some of the x86 signal code uses). So one of the advantages of just copy_to_user() ends up being visible only on Broadwell+ (or whatever the SMAP cutoff is). Linus