Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753481AbdFVRyk (ORCPT ); Thu, 22 Jun 2017 13:54:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33494 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751221AbdFVRyi (ORCPT ); Thu, 22 Jun 2017 13:54:38 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3170F7F40D Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pabeni@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3170F7F40D Message-ID: <1498154074.2503.11.camel@redhat.com> Subject: Re: [PATCH] x86/uaccess: use unrolled string copy for short strings From: Paolo Abeni To: Linus Torvalds Cc: the arch/x86 maintainers , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Al Viro , Kees Cook , Hannes Frederic Sowa , Linux Kernel Mailing List Date: Thu, 22 Jun 2017 19:54:34 +0200 In-Reply-To: References: <63d913f28bc64bd4ea66a39a532f0b59ee015382.1498039056.git.pabeni@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 22 Jun 2017 17:54:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 751 Lines: 19 On Thu, 2017-06-22 at 10:30 -0700, Linus Torvalds wrote: > So if you want to do this optimization, I'd argue that you should just > do it inside the copy_user_enhanced_fast_string() function itself, the > same way we already handle the really small case specially in > copy_user_generic_string(). > > And do *not* use the unrolled code, which isn't used for small copies > anyway - rewrite the "copy_user_generic_unrolled" function in that > same asm file to have the non-unrolled cases (label "17" and forward) > accessible, so that you don't bother re-testing the size. Thank you for the feedback. I'm quite new to the core x86 land; the rep stosb cost popped out while messing with the networking. I'll try to dig into the asm. Regards, Paolo