Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756713AbdGXTMo (ORCPT ); Mon, 24 Jul 2017 15:12:44 -0400 Received: from out02.mta.xmission.com ([166.70.13.232]:58952 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756437AbdGXTKN (ORCPT ); Mon, 24 Jul 2017 15:10:13 -0400 From: ebiederm@xmission.com (Eric W. Biederman) To: Linus Torvalds 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 References: <87o9shg7t7.fsf_-_@xmission.com> <20170718140651.15973-7-ebiederm@xmission.com> <878tjlbqpt.fsf@xmission.com> <8760ek5ics.fsf_-_@xmission.com> Date: Mon, 24 Jul 2017 14:01:59 -0500 In-Reply-To: (Linus Torvalds's message of "Mon, 24 Jul 2017 10:43:34 -0700") Message-ID: <87r2x54q1k.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1dZik0-0003sW-19;;;mid=<87r2x54q1k.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=67.3.213.87;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX195GQ2fkmJKpFe3ZjPcgfi36lQOpnGtbC0= X-SA-Exim-Connect-IP: 67.3.213.87 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.5 XMGappySubj_01 Very gappy subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Linus Torvalds X-Spam-Relay-Country: X-Spam-Timing: total 5690 ms - load_scoreonly_sql: 0.04 (0.0%), signal_user_changed: 5 (0.1%), b_tie_ro: 3.0 (0.1%), parse: 1.18 (0.0%), extract_message_metadata: 20 (0.4%), get_uri_detail_list: 1.66 (0.0%), tests_pri_-1000: 8 (0.1%), tests_pri_-950: 1.16 (0.0%), tests_pri_-900: 1.02 (0.0%), tests_pri_-400: 43 (0.8%), check_bayes: 42 (0.7%), b_tokenize: 10 (0.2%), b_tok_get_all: 16 (0.3%), b_comp_prob: 3.1 (0.1%), b_tok_touch_all: 2.8 (0.0%), b_finish: 6 (0.1%), tests_pri_0: 268 (4.7%), check_dkim_signature: 0.67 (0.0%), check_dkim_adsp: 3.6 (0.1%), tests_pri_500: 5337 (93.8%), poll_dns_idle: 5332 (93.7%), rewrite_mail: 0.00 (0.0%) Subject: Re: Simplfying copy_siginfo_to_user X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1178 Lines: 31 Linus Torvalds writes: > 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). Good point. The cpu I was testing on was an AMD A10. I don't actually have a cpu that supports SMAP handy. If you would like I can post the minimal patches and benckmark so anyone who is interested could reproduce this for themselves. I suspect that if it is down to only 20ns without SMAP this will definitely be a performance improvement in the presence of SMAP. Eric