Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755065AbdGYBiJ (ORCPT ); Mon, 24 Jul 2017 21:38:09 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:53992 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751944AbdGYBiF (ORCPT ); Mon, 24 Jul 2017 21:38:05 -0400 Date: Tue, 25 Jul 2017 02:37:57 +0100 From: Al Viro To: Linus Torvalds Cc: "Eric W. Biederman" , Linux Kernel Mailing List , Andy Lutomirski , 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 Subject: Re: Simplfying copy_siginfo_to_user Message-ID: <20170725013756.GH2063@ZenIV.linux.org.uk> 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.3 (2017-05-23) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1405 Lines: 31 On Mon, Jul 24, 2017 at 10:43:34AM -0700, Linus Torvalds wrote: > 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). Guys, could you take a look at vfs.git#work.siginfo? I'd been pretty much buried lately (and probably will for several more weeks - long-distance moves *suck*), so that thing got stalled, but it might be worth a look. The code generated in copy_siginfo_to_user() in it looks reasonably good, we don't copy more than we need and all copying to userland is done by copy_to_user() - one call per call of copy_siginfo_to_user(), so SMAP crap is not an issue. The next thing I hope to do is converting compat side of that thing to the same; that got stalled. Al "Buried in boxes" Viro...