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 A2FBFEB64DA for ; Sun, 16 Jul 2023 11:57:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229877AbjGPL5l (ORCPT ); Sun, 16 Jul 2023 07:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbjGPL5k (ORCPT ); Sun, 16 Jul 2023 07:57:40 -0400 Received: from out-60.mta1.migadu.com (out-60.mta1.migadu.com [95.215.58.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14F88191 for ; Sun, 16 Jul 2023 04:57:39 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1689508657; 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=r/jpV+8O9oZV9vdgrLCMsYyKMoNbEASmkVXWNW88mJw=; b=jk64N0LhxkADlYZBQH/RIbFQ52jc7bcfOVzCD8uWbBLZ0pH8Vu6XqpNXVsWAfqDQa3jDYX Pb+LYPHRBkah5EvYhoxNoprNVbPFOQ2Bw8ewtBQrL6wOnemP/4Gr37MCmAPd2aB5nR+ZZv gMUEN+XF83M2dP6gBXqxrPj4oqi6S5c= Date: Sun, 16 Jul 2023 19:57:26 +0800 MIME-Version: 1.0 Subject: Re: [PATCH 3/3] io_uring: add support for getdents Content-Language: en-US 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> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Hao Xu In-Reply-To: <20230713-verglast-pfuschen-50197f8be98b@brauner> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org 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