From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8108EB64DA for ; Tue, 18 Jul 2023 06:55:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231128AbjGRGzo (ORCPT ); Tue, 18 Jul 2023 02:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbjGRGzn (ORCPT ); Tue, 18 Jul 2023 02:55:43 -0400 Received: from out-62.mta1.migadu.com (out-62.mta1.migadu.com [95.215.58.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85D501A6 for ; Mon, 17 Jul 2023 23:55:42 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689663340; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=byzEJ8KQDir+xTs9pfgOhNsoeOFRsWikoU7YhfIE5oo=; b=oTO3y2PcfO14EfDH2drouQqLTF1iu3gLCOv6ePkBHxmqKsNQKDALb2Gm48b0kfCT0Fqvem ZZfpZoHgRBP2VLe3sS+9qcsX0Esxc0UPmsVdAXc/9fEt5PXD6mTs5Gz01gCuXUTzt7gnHO s+ExkqXjjdjv9I5wi6X4ch8QYtebr7U= Date: Tue, 18 Jul 2023 14:55:03 +0800 MIME-Version: 1.0 Subject: Re: [PATCH 3/3] io_uring: add support for getdents Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Hao Xu To: Christian Brauner Cc: io-uring@vger.kernel.org, Jens Axboe , Dominique Martinet , Pavel Begunkov , Alexander Viro , Stefan Roesch , Clay Harris , Dave Chinner , linux-fsdevel@vger.kernel.org, Wanpeng Li References: <20230711114027.59945-1-hao.xu@linux.dev> <20230711114027.59945-4-hao.xu@linux.dev> <20230712-alltag-abberufen-67a615152bee@brauner> <20230713-sitzt-zudem-67bc5d860cb4@brauner> <20230713-verglast-pfuschen-50197f8be98b@brauner> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On 7/16/23 19:57, Hao Xu wrote: > On 7/13/23 23:14, Christian Brauner wrote: > >> Could someone with perf experience try and remove that f_count == 1 >> optimization from __fdget_pos() completely and make it always acquire >> the mutex? I wonder what the performance impact of that is. > > Hi Christian, > For your reference, I did a simple test: writed a c program that open a > directory which has 1000 empty files, then call sync getdents64 on it > repeatedly until we get all the entries. I run this program 10 times for > "with f_count==1 > optimization" and "always do the lock" version. > Got below data: > with f_count==1: > > time cost: 0.000379 > time cost: 0.000116 > time cost: 0.000090 > time cost: 0.000101 > time cost: 0.000095 > time cost: 0.000092 > time cost: 0.000092 > time cost: 0.000095 > time cost: 0.000092 > time cost: 0.000121 > time cost: 0.000092 > > time cost avg: 0.00009859999999999998 > > always do the lock: > time cost: 0.000095 > time cost: 0.000099 > time cost: 0.000123 > time cost: 0.000124 > time cost: 0.000092 > time cost: 0.000099 > time cost: 0.000092 > time cost: 0.000092 > time cost: 0.000093 > time cost: 0.000094 >             time cost avg: 0.00010029999999999997 > > So about 1.724% increment > > [1] the first run is not showed here since that try does real IO >     and diff a lot. > [2] the time cost calculation is by gettimeofday() > [3] run it in a VM which has 2 CPUs and 1GB memory. > > Regards, > Hao Did another similar test for more times(100 rounds), about 1.4% increment. How about: if CONFIG_IO_URING: remove the f_count==1 logic else: do the old logic.