Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp645588pxa; Wed, 19 Aug 2020 10:52:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw8vKpLLj9zMEV0R7behlyQzOn1vYdvDUi3YcuFem4T1CTAIfIiatMhVpNHd2uIyX3jzMa6 X-Received: by 2002:a17:906:e0d:: with SMTP id l13mr27712262eji.434.1597859573376; Wed, 19 Aug 2020 10:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597859573; cv=none; d=google.com; s=arc-20160816; b=B7sjLuEFjbFEPGYilV6WsYQ7LYBW9i3CX3E59sVKSVyAPVmD26KWsmeS+pccbAYnqw QMYR9bb1DCUyN25muWhWmf0v/pWHzPpUt0s49WPwaiobZUSVeV8vQxEzMbs+Z+q2fVBa QK75C+ty66MiB3xRC16/vkQxwU1naE5ggwQshjNfsGV/DWOPUS1cwg0seTjiGNyfx9Ck tVlKs8EjRc/RfStnqtTuYvWWnnQR1UbC/iAuDhpzC8VqzSHjQMQgTl9BKdXFCBbQJgPL y7uR91mWBoJ2pjgjBOLyIwnxoNE9FkmGj76+yWCgXPS0rBcehcvgs5tOy1Vk2amZMHfw yPMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Z5e7UHlDL85q2gqXMCVtZKmx0YLbFpRIJgBOrgYQ/HE=; b=LJLty9ymrLzaxX8QmUzWeKtUZEiyw5nTm+9eO3yOmJFjKQvE1UpxTc7DNLHvUmmZ7t yf9z0oCI+ZBv/dzJO+67MUz0rZKY7B6d73ZdcShzgUYYOBXu7bs5ep1kaXeb1Jh+wQz2 O7xFpeYhXlngqlN9A3LocANjIGpUQNLKGsCcH0YmKMSal34uVSV4UWmRQFkZbWbJz7aI E1Yeo0l3QRGq/kULke4fkvVERsgKuNFHtEVnF0dxI6qEgvyTcHMA2+0BZ7DE8Z2UcWWg TypOyI3gJAumRS1xyKTaOgsZz7JMftNGgy+5lmbt3OZbxGkLbpyC6O1Tz1gvCykcijLN vBSg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k19si15983332ejg.29.2020.08.19.10.52.29; Wed, 19 Aug 2020 10:52:53 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726681AbgHSRtm (ORCPT + 99 others); Wed, 19 Aug 2020 13:49:42 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:38683 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725804AbgHSRtm (ORCPT ); Wed, 19 Aug 2020 13:49:42 -0400 Received: from callcc.thunk.org (pool-108-49-65-20.bstnma.fios.verizon.net [108.49.65.20]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 07JHnPOv028075 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Aug 2020 13:49:25 -0400 Received: by callcc.thunk.org (Postfix, from userid 15806) id 0505342010C; Wed, 19 Aug 2020 13:49:24 -0400 (EDT) Date: Wed, 19 Aug 2020 13:49:24 -0400 From: "Theodore Y. Ts'o" To: Xing Zhengjun Cc: Ritesh Harjani , kernel test robot , kbuild test robot , Jan Kara , "Darrick J. Wong" , LKML , lkp@lists.01.org Subject: Re: [LKP] Re: [ext4] d3b6f23f71: stress-ng.fiemap.ops_per_sec -60.5% regression Message-ID: <20200819174924.GB5561@mit.edu> References: <20200407080036.GA8179@shao2-debian> <20200715110437.7D0A3AE051@d06av26.portsmouth.uk.ibm.com> <705b788f-aac3-f622-a286-ecd99deb5ca9@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Looking at what the stress-ng fiemap workload is doing, and it's.... interesting. It is running 4 processes which are calling FIEMAP on a particular file in a loop, with a 25ms sleep every 64 times. And then there is a fifth process which is randomly writing to the file and calling punch_hole to random offsets in the file. So this is quite different from what Ritesh has been benchmarking which is fiemap in isolation, as opposed to fiemap racing against a 3 other fiemap processes plus a process which is actively modifying the file. In the original code, if I remember correctly, we were using a shared reader/writer lock to look at the extent tree blocks directly, but we hold the i_data_sem rw_sempahore for the duration of the fiemap call. In the new code, we're going through the extent_status cache, which is grabbing the rw_spinlock each time we do a lookup in the extents status tree. So this is a much finer-grained locking and that is probably the explanation for the increased time for running fiemap in the contended case. If this theory is correct, we would probably get back the performance by wrapping the calls to iomap_fiemap() with {up,down}_read(&ei->i_data_sem) in ext4_fiemap(). That being said, however ---- it's clear what real-life workload cares about FIEMAP performance, especially with multiple threads all calling FIEMAP racing against a file which is being actively modified. Having stress-ng do this to find potential kernel bugs is a great thing, so I understand why stress-ng might be doing this as a QA tool. Why we should care about stress-ng as a performance benchmark, at least in this case, is much less clear to me. Cheers, - Ted