Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4982531rdb; Fri, 15 Sep 2023 20:32:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwq/jDEsS2J+akibCVMG2leqsG5GReyxCOA5YEySJ7NyUQRECGTc1kKTe7NHzXp6H5nBqi X-Received: by 2002:a05:6870:b693:b0:1d5:b9e1:d35e with SMTP id cy19-20020a056870b69300b001d5b9e1d35emr4692753oab.41.1694835158352; Fri, 15 Sep 2023 20:32:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694835158; cv=none; d=google.com; s=arc-20160816; b=KCUw+4dtMn+H3lOfC+BSJwIaquJWFP5caMOVnUhzAwtjLROM3nTfNZ4W3nIpqoM093 Zgw1XVsMQm9MPNxRKKehy7lxwbMH+zotk0EAqJXlnQ5u2m62crdE/19DvDKMM7gviMqf YZy6KWGETNz0qRfrt77gfzW8AODRh1vFv3HJi8N6/2AeI+1a/p1N/1eo38MD9O2NenIm BX5QxOu1A9TLVhvUiKUaO9TdLYwPiQE2Me5drdQgzBNR7uQgPp2swCCMZIXXz0oqLP5F UXmrzOoQiF+TCmMF0l61EEedxSVwe6Lp0lVAs65ZbZ9Shy4wnKnBbVrCWLgh0GV3SDAN RpGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-id:mime-version:subject :cc:to:references:in-reply-to:from:organization:dkim-signature; bh=S6YdaabWMt5kMqbNYNBaQroIwASFlYwE8xKBnDy2tD0=; fh=1/H2r+UMnh1lHa0GLAnS3E3+hPDfZnMip7rm4ItSBGQ=; b=W2BLAFzrAN1NQ727Qy1swxzrzwdUWpMtXqCqN3ucxKCOgI3F6TuzAqLcHBNOv18Tcj XM168QBtix1rP9DvKfYT5zpsFEs23p0Xygu6biTjIsBHo+rg5TlA9M3N8JXN8cLpC3hU 843MLed07g3Tb3YelK1atZbPqNCbCJnHeMVM2bcDJUgF9z9W7PZEwCzE7OCKZZ6SwJax 4GPRny0sEQrOvFmKkbhnA636z4qAxzHREPgdcM9n523pCiWowCXmyGO0OOWYpT0QS87M ArGRQlNU74YgE+W2LnrbL3mVPQKS9IvR+YvdZWqt7q0SXRHa/5Wlc2BU1hVI8M+rVClQ KEyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fBkFJSU5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id x71-20020a63864a000000b00577521a5503si4129769pgd.475.2023.09.15.20.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 20:32:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fBkFJSU5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id F3D6C8246319; Fri, 15 Sep 2023 05:21:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234775AbjIOMVG (ORCPT + 99 others); Fri, 15 Sep 2023 08:21:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234748AbjIOMVE (ORCPT ); Fri, 15 Sep 2023 08:21:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BE80A272C for ; Fri, 15 Sep 2023 05:19:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694780392; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=S6YdaabWMt5kMqbNYNBaQroIwASFlYwE8xKBnDy2tD0=; b=fBkFJSU5ys6bpOwGN3QWLepnmKGp5DnhO1pSM6RMHC6LRdzJiLbIgljhvcyplKDKJRSGZW coO7QmI3S7pnST/Y1EflUef+M6Hjn1xXaDFyXj253P/eCFM28P6KcNwduBcWjxiSCXDx84 MWwIPZKcbb1PqTobqB3lIsvh8bHb7Ls= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-426-7G8sFEHCP9WrzceNBoHclg-1; Fri, 15 Sep 2023 08:19:49 -0400 X-MC-Unique: 7G8sFEHCP9WrzceNBoHclg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CEA2E857F8A; Fri, 15 Sep 2023 12:19:48 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.216]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B0591004145; Fri, 15 Sep 2023 12:19:46 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <20230914221526.3153402-1-dhowells@redhat.com> <20230914221526.3153402-10-dhowells@redhat.com> To: David Laight Cc: dhowells@redhat.com, Al Viro , Linus Torvalds , Jens Axboe , Christoph Hellwig , "Christian Brauner" , Matthew Wilcox , "Brendan Higgins" , David Gow , "linux-fsdevel@vger.kernel.org" , "linux-block@vger.kernel.org" , "linux-mm@kvack.org" , "netdev@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "kunit-dev@googlegroups.com" , "linux-kernel@vger.kernel.org" , Andrew Morton , Christian Brauner , David Hildenbrand , John Hubbard Subject: Re: [RFC PATCH 9/9] iov_iter: Add benchmarking kunit tests for UBUF/IOVEC MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3545839.1694780385.1@warthog.procyon.org.uk> Date: Fri, 15 Sep 2023 13:19:45 +0100 Message-ID: <3545840.1694780385@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 05:21:08 -0700 (PDT) David Laight wrote: > Isn't that going to be completely dominated by the cache fills > from memory? > > I'd have thought you'd need to use something with a lot of > small fragments so that the iteration code dominates the copy. Okay, if I switch it to using MAP_ANON for the big 256MiB buffer, switch all the benchmarking tests to use copy_from_iter() rather than copy_to_iter() and make the iovec benchmark use a separate iovec for each page, there's then a single page replicated across the mapping. Given that, without my macro-to-inline-func patches applied, I see: iov_kunit_benchmark_bvec: avg 3184 uS, stddev 16 uS iov_kunit_benchmark_bvec: avg 3189 uS, stddev 17 uS iov_kunit_benchmark_bvec: avg 3190 uS, stddev 16 uS iov_kunit_benchmark_bvec_outofline: avg 3731 uS, stddev 10 uS iov_kunit_benchmark_bvec_outofline: avg 3735 uS, stddev 10 uS iov_kunit_benchmark_bvec_outofline: avg 3738 uS, stddev 11 uS iov_kunit_benchmark_bvec_split: avg 3403 uS, stddev 10 uS iov_kunit_benchmark_bvec_split: avg 3405 uS, stddev 18 uS iov_kunit_benchmark_bvec_split: avg 3407 uS, stddev 29 uS iov_kunit_benchmark_iovec: avg 6616 uS, stddev 20 uS iov_kunit_benchmark_iovec: avg 6619 uS, stddev 22 uS iov_kunit_benchmark_iovec: avg 6621 uS, stddev 46 uS iov_kunit_benchmark_kvec: avg 2671 uS, stddev 12 uS iov_kunit_benchmark_kvec: avg 2671 uS, stddev 13 uS iov_kunit_benchmark_kvec: avg 2675 uS, stddev 12 uS iov_kunit_benchmark_ubuf: avg 6191 uS, stddev 1946 uS iov_kunit_benchmark_ubuf: avg 6418 uS, stddev 3263 uS iov_kunit_benchmark_ubuf: avg 6443 uS, stddev 3275 uS iov_kunit_benchmark_xarray: avg 3689 uS, stddev 5 uS iov_kunit_benchmark_xarray: avg 3689 uS, stddev 6 uS iov_kunit_benchmark_xarray: avg 3698 uS, stddev 22 uS iov_kunit_benchmark_xarray_outofline: avg 4202 uS, stddev 3 uS iov_kunit_benchmark_xarray_outofline: avg 4204 uS, stddev 9 uS iov_kunit_benchmark_xarray_outofline: avg 4210 uS, stddev 9 uS and with, I get: iov_kunit_benchmark_bvec: avg 3241 uS, stddev 13 uS iov_kunit_benchmark_bvec: avg 3245 uS, stddev 16 uS iov_kunit_benchmark_bvec: avg 3248 uS, stddev 15 uS iov_kunit_benchmark_bvec_outofline: avg 3705 uS, stddev 12 uS iov_kunit_benchmark_bvec_outofline: avg 3706 uS, stddev 10 uS iov_kunit_benchmark_bvec_outofline: avg 3709 uS, stddev 9 uS iov_kunit_benchmark_bvec_split: avg 3446 uS, stddev 10 uS iov_kunit_benchmark_bvec_split: avg 3447 uS, stddev 12 uS iov_kunit_benchmark_bvec_split: avg 3448 uS, stddev 12 uS iov_kunit_benchmark_iovec: avg 6587 uS, stddev 22 uS iov_kunit_benchmark_iovec: avg 6587 uS, stddev 22 uS iov_kunit_benchmark_iovec: avg 6590 uS, stddev 27 uS iov_kunit_benchmark_kvec: avg 2671 uS, stddev 12 uS iov_kunit_benchmark_kvec: avg 2672 uS, stddev 12 uS iov_kunit_benchmark_kvec: avg 2676 uS, stddev 19 uS iov_kunit_benchmark_ubuf: avg 6241 uS, stddev 2199 uS iov_kunit_benchmark_ubuf: avg 6266 uS, stddev 2245 uS iov_kunit_benchmark_ubuf: avg 6513 uS, stddev 3899 uS iov_kunit_benchmark_xarray: avg 3695 uS, stddev 6 uS iov_kunit_benchmark_xarray: avg 3695 uS, stddev 7 uS iov_kunit_benchmark_xarray: avg 3703 uS, stddev 11 uS iov_kunit_benchmark_xarray_outofline: avg 4215 uS, stddev 16 uS iov_kunit_benchmark_xarray_outofline: avg 4217 uS, stddev 20 uS iov_kunit_benchmark_xarray_outofline: avg 4224 uS, stddev 10 uS Interestingly, most of them are quite tight, but UBUF is all over the place. That's with the test covering the entire 256M span with a single UBUF iterator, so it would seem unlikely that the difference is due to the iteration framework. David