Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4502581pxj; Tue, 22 Jun 2021 01:31:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlCQLKTEd4JX0kTavj22iK8TPqTiFGX6obV6bACEFMBNOWzKF5FrpX1Qk9xZkRoszDW6+s X-Received: by 2002:a02:90cb:: with SMTP id c11mr2851424jag.53.1624350676051; Tue, 22 Jun 2021 01:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624350676; cv=none; d=google.com; s=arc-20160816; b=qWOD/gzT19CoWBLC8OM0fq6isDMjuIwBJUz3HRBYHWc5dnFylNMOVgJhijzd1+EsAU 786kwp6uIWYhodQSaYaovutr5IEq52lhfvZQ+W1VBTVC+BolmhrQ/XEB4OB26zt2C1th eddPIdtXtjJk2Yi3majAtUzf87g7d9DszPDWDZxsboJ454McNw9qw4elC21FgO8Hqlxo gJcYKQS3XbDEjivJGuco3WB2wG0VIrqEu3T7C3FXjg+jomkAdEbwEW+G9pB2cLHwP4zp JdoeQHkFZQkwFpyc3qiiqCebUAsmqA64a9Jwi47wFm1Lda1sUCBKizbLHersPSyXp7CN EXxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:to:subject; bh=fFco3Y+ucj+Hz5H+HAY+zqN8Uigjw5oWXiYq2qbhp0w=; b=BCtELYEK/q/U5K2KmuSxBFE7KBLqdVJSi09SjX8k/mOdVmzoBYzcs6SLs+lQTh5txL RjQzso86lErfBi0R94Spp/9cb693F5CBUyzws3/t8lVWgx8Xqzd3mFJdQpZDXe4mSXE8 1Bor03+OL5eBBH+pfwusPkolE0vL75IKL9ohxbaMUIY/OuxckMSXGcbu8+Nu6h/Wxlys lqgPzNo4+YaF+4AtCxLaEabExKS5RxLOMUwiKe86R3l18IZZr6rQljpYp/rSR9yJZeqE A3vPhjpxdsoxXygxMT3FK/FI+BiAOg+rUl1263gnQuA/XcDNoKehZHdZY6z40qtX2kUZ 1Wyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si17037448ilu.13.2021.06.22.01.31.03; Tue, 22 Jun 2021 01:31:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=codethink.co.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230076AbhFVIcr (ORCPT + 99 others); Tue, 22 Jun 2021 04:32:47 -0400 Received: from imap2.colo.codethink.co.uk ([78.40.148.184]:38916 "EHLO imap2.colo.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229747AbhFVIcq (ORCPT ); Tue, 22 Jun 2021 04:32:46 -0400 Received: from cpc152649-stkp13-2-0-cust121.10-2.cable.virginm.net ([86.15.83.122] helo=[192.168.0.18]) by imap2.colo.codethink.co.uk with esmtpsa (Exim 4.92 #3 (Debian)) id 1lvbng-0006ij-CB; Tue, 22 Jun 2021 09:30:28 +0100 Subject: Re: [PATCH v2 0/5] riscv: improving uaccess with logs from network bench To: Akira Tsukamoto , Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org References: <5a5c07ac-8c11-79d3-46a3-a255d4148f76@gmail.com> From: Ben Dooks Organization: Codethink Limited. Message-ID: Date: Tue, 22 Jun 2021 09:30:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: <5a5c07ac-8c11-79d3-46a3-a255d4148f76@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/06/2021 12:21, Akira Tsukamoto wrote: > Optimizing copy_to_user and copy_from_user. > > I rewrote the functions in v2, heavily influenced by Garry's memcpy > function [1]. > The functions must be written in assembler to handle page faults manually > inside the function. > > With the changes, improves in the percentage usage and some performance > of network speed in UDP packets. > Only patching copy_user. Using the original memcpy. > > All results are from the same base kernel, same rootfs and same > BeagleV beta board. > > Comparison by "perf top -Ue task-clock" while running iperf3. I did a quick test on a SiFive Unmatched with IO to an NVME. before: cached-reads=172.47MB/sec, buffered-reads=135.8MB/sec with-patch: cached-read=s177.54Mb/sec, buffered-reads=137.79MB/sec That was just one test run, so there was a small improvement. I am sort of surprised we didn't get more of a win from this. perf record on hdparm shows that it spends approx 15% cpu time in asm_copy_to_user. Does anyone have a benchmark for this which just looks at copy/to user? if not should we create one? -- Ben Dooks http://www.codethink.co.uk/ Senior Engineer Codethink - Providing Genius https://www.codethink.co.uk/privacy.html