Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp474172pxb; Sat, 20 Feb 2021 09:48:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzodL6NlGKuF3ybyX5ht8k8SeMhlqyh5KggAGRWI14ewMdXR3+PyDLnPM0n2pSD3MdcivZR X-Received: by 2002:a17:906:2816:: with SMTP id r22mr13710830ejc.2.1613843324808; Sat, 20 Feb 2021 09:48:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613843324; cv=none; d=google.com; s=arc-20160816; b=B54/LX32ge8Bnva7nV/CCwCjTPEWCYaRklsmHdoUt0jAz/iPS/jrz4ZQMPyrn44TV2 AdPyPYUK0hjq0ZLhleBhgNuq8xrwPo2eWd3osWt8P7SoGvcCn8w3CK3qFr3Xh8j04ois G7ICLv9URU2PPjNE/svGidPL1fMHrSRPAVOkpotiHWlbk+RAoKJajslXtFrMfxEu2mfe qmsF7p/8xckKdptvD8jOWl9YdD+4F/CLXSt7xhQqhno8envSZTtPWH7+5ADekhmxRwo9 ax/vy2Mxl3wSV6jn75Rcb+DdV+UDSsvXhuM/+4uPFyZPJfy9PiLrPX6qSxd1c4tg+jCn CAVQ== 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 :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=TTAhFyaK1OitwDvbY/HCQu/in9dMgVzbf1YjTMFhbak=; b=DzHtePao5Z/jtsqYt1GZzDLkcw43hoYt2WiZt11zVVXxBGq1SXd56iMkBRmrPkN+Dz sS4/91oXvMjiRFB9hjyb3SqCkaswJtjJaTkUsxG7Ybsu7s7lNBFqkoKJbaEN94au9JLC moqACefJRf+ITrt0RldzOd+ATkSXwkVpeOi23EAmvnv6QtrvjcohwnuQe2BMRzNIpJrH 8ljrQP9K8YS9C9IsJg9a7ArwLCLttTk75tCDbhiWkObPd0pYatH/cj7DtmqbuRJEZLkj 9ru5HVpVxaCQ2yJ0M9p+eLHTcir4h8TTESTcJpF0rb3PakzWRM5IOLLMRt5eeN/YdQxs CwhA== 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=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t16si9702023edi.293.2021.02.20.09.48.21; Sat, 20 Feb 2021 09:48:44 -0800 (PST) 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=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbhBTRpr convert rfc822-to-8bit (ORCPT + 99 others); Sat, 20 Feb 2021 12:45:47 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([185.58.86.151]:45138 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229784AbhBTRpq (ORCPT ); Sat, 20 Feb 2021 12:45:46 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-261-9s6Dn3PkOTySVu2_pMSh9w-1; Sat, 20 Feb 2021 17:44:07 +0000 X-MC-Unique: 9s6Dn3PkOTySVu2_pMSh9w-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Sat, 20 Feb 2021 17:44:06 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Sat, 20 Feb 2021 17:44:06 +0000 From: David Laight To: 'Lennert Buytenhek' , Jens Axboe , Al Viro , "linux-kernel@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "io-uring@vger.kernel.org" CC: Matthew Wilcox Subject: RE: [PATCH v3 0/2] io_uring: add support for IORING_OP_GETDENTS Thread-Topic: [PATCH v3 0/2] io_uring: add support for IORING_OP_GETDENTS Thread-Index: AQHXBfFRAjVxpRid2k+E4G2FbTp65qphUAow Date: Sat, 20 Feb 2021 17:44:06 +0000 Message-ID: <247d154f2ba549b88a77daf29ec1791f@AcuMS.aculab.com> References: <20210218122640.GA334506@wantstofly.org> In-Reply-To: <20210218122640.GA334506@wantstofly.org> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lennert Buytenhek > Sent: 18 February 2021 12:27 > > These patches add support for IORING_OP_GETDENTS, which is a new io_uring > opcode that more or less does an lseek(sqe->fd, sqe->off, SEEK_SET) > followed by a getdents64(sqe->fd, (void *)sqe->addr, sqe->len). > > A dumb test program for IORING_OP_GETDENTS is available here: > > https://krautbox.wantstofly.org/~buytenh/uringfind-v2.c > > This test program does something along the lines of what find(1) does: > it scans recursively through a directory tree and prints the names of > all directories and files it encounters along the way -- but then using > io_uring. (The io_uring version prints the names of encountered files and > directories in an order that's determined by SQE completion order, which > is somewhat nondeterministic and likely to differ between runs.) > > On a directory tree with 14-odd million files in it that's on a > six-drive (spinning disk) btrfs raid, find(1) takes: > > # echo 3 > /proc/sys/vm/drop_caches > # time find /mnt/repo > /dev/null > > real 24m7.815s > user 0m15.015s > sys 0m48.340s > # > > And the io_uring version takes: > > # echo 3 > /proc/sys/vm/drop_caches > # time ./uringfind /mnt/repo > /dev/null > > real 10m29.064s > user 0m4.347s > sys 0m1.677s > # While there may be uses for IORING_OP_GETDENTS are you sure your test is comparing like with like? The underlying work has to be done in either case, so you are swapping system calls for code complexity. I suspect that find is actually doing a stat() call on every directory entry and that your io_uring example is just believing the 'directory' flag returned in the directory entry for most modern filesystems. If you write a program that does openat(), readdir(), close() for each directory and with a long enough buffer (mostly) do one readdir() per directory you'll get a much better comparison. You could even write a program with 2 threads, one does all the open/readdir/close system calls and the other does the printing and generating the list of directories to process. That should get the equivalent overlapping that io_uring gives without much of the complexity. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)