Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2238297imu; Wed, 21 Nov 2018 08:35:54 -0800 (PST) X-Google-Smtp-Source: AFSGD/VuHKHzdAgvG6U3B4IolPDTv6KgE8WauvXoZS6p18fhe9k8LS9Wjxu6mPjT7PPqPuwDAsGn X-Received: by 2002:a17:902:1006:: with SMTP id b6-v6mr7304481pla.252.1542818154219; Wed, 21 Nov 2018 08:35:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542818154; cv=none; d=google.com; s=arc-20160816; b=bUwRW7oLsBfKqkGLJjc/UA8duiFm8ISZEfv+wZhZMMHOXZjDZ8FQd/hJHZQAtVSWVM eUzmIl2WIpjqPqvPSk3+Xt+Ep2fMrUIXvVemN4K/on9y2R+ZYTCXZx1BjuvenvMdtcLp 3FDgfeCg51z/5ZvvQiXTii/rN32Us1o1sWAVVgZy2v5pCbyYd+uI0krySKa/9WnXOBIG FLOxxoQ8o80/9BI5ka+Zk+ZECiyRrQ/1SyXIRqpk+PKw4hyoJC9LdtrFi3Pgudxwl6qi pl3adTrAGyqU59avR3OL5ubfvOWPK1pWyNz7L0LlC2AjQybJ8MTINKtxIn1VqkeLibvE AHIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=f4o6X5bGGIcdZ6Ef7JSniUTb6gEa1E5LySrkrceTI9o=; b=OszVKf/q98asYSHysnmTpmrUep7EPvDDAOmADIW6Cf9lEFHqbqfzF1PGcNrxVEZvNK TQzR3HNszKUQhKaea6M0i97i6bOqALBAxKr/1n1Rjg9v2sNqMGOk3IWRqrPUK60rQn+2 eX8zpW8KT3Gr23YCYMzLMP0FVGQ0g8qQhf/kCKcAafNi94Xh3hu79+krce5LPy57KIGc 467MKDRIQWlDU7xPZolEyVQVVq3oQAy+anytcewuepSikfJiAB/9A6W2IyzAv1HEnPhZ knB3RLHok+cvbUpj32jNVHBkR3e61syYl9aqWZZZVBkzvVCwz/pkGCNXf0xZ19UzQKTR D3KA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si6741049plh.426.2018.11.21.08.35.36; Wed, 21 Nov 2018 08:35:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729986AbeKVATo (ORCPT + 99 others); Wed, 21 Nov 2018 19:19:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45663 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727486AbeKVATo (ORCPT ); Wed, 21 Nov 2018 19:19:44 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E35C8F50A; Wed, 21 Nov 2018 13:45:16 +0000 (UTC) Received: from localhost.localdomain (unknown [10.32.181.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id A04AF60923; Wed, 21 Nov 2018 13:45:13 +0000 (UTC) Message-ID: <1c22125bb5d22c2dcd686d0d3b390f115894f746.camel@redhat.com> Subject: Re: [PATCH] x86: only use ERMS for user copies for larger sizes From: Paolo Abeni To: Jens Axboe , Ingo Molnar Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , the arch/x86 maintainers , Linus Torvalds , Andrew Morton , Andy Lutomirski , Peter Zijlstra , Denys Vlasenko , Brian Gerst , linux-kernel@vger.kernel.org Date: Wed, 21 Nov 2018 14:45:12 +0100 In-Reply-To: <48e27a3a-2bb2-ff41-3512-8aeb3fd59e57@kernel.dk> References: <02bfc577-32a5-66be-64bf-d476b7d447d2@kernel.dk> <20181121063609.GA109082@gmail.com> <48e27a3a-2bb2-ff41-3512-8aeb3fd59e57@kernel.dk> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 21 Nov 2018 13:45:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2018-11-21 at 06:32 -0700, Jens Axboe wrote: > I did some more investigation yesterday, and found this: > > commit 236222d39347e0e486010f10c1493e83dbbdfba8 > Author: Paolo Abeni > Date: Thu Jun 29 15:55:58 2017 +0200 > > x86/uaccess: Optimize copy_user_enhanced_fast_string() for short strings > > which does attempt to rectify it, but only using ERMS for >= 64 byte copies. > At least for me, looks like the break even point is higher than that, which > would mean that something like the below would be more appropriate. Back then I used a custom kernel module and the tsc to micro-benchmark the patched function and the original one with different buffer sizes. I'm sorry, the relevant code has been lost. In my experiments 64 bytes was the break even point for all the CPUs I had handy, but I guess that may change with other models. Cheers, Paolo