From patchwork Fri Sep 13 13:54:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13803486 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D24EEFA3757 for ; Fri, 13 Sep 2024 13:54:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D3ED6B00CB; Fri, 13 Sep 2024 09:54:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 283456B00CC; Fri, 13 Sep 2024 09:54:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 124486B00CD; Fri, 13 Sep 2024 09:54:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E8CE76B00CB for ; Fri, 13 Sep 2024 09:54:24 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8F0D8162024 for ; Fri, 13 Sep 2024 13:54:24 +0000 (UTC) X-FDA: 82559859648.18.ED259B0 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf24.hostedemail.com (Postfix) with ESMTP id C8D02180010 for ; Fri, 13 Sep 2024 13:54:21 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YlvPP8gh; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf24.hostedemail.com: domain of jlayton@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726235575; a=rsa-sha256; cv=none; b=gqO0bw1TCD5nEW+nKzDn936zAzG7FfFy9rkGckBTAMm1b1TXxDS/K2wrEoKVFUX8WALkPY OhwwzCOWz6dvILWFT5ee0x2fbh0DHgtu/nX6YLPMe5LUYBxRVLf7Llm+6bzCPOEy64bbRB 4bkL9wf++aaOtAgVUQrin2t4W3EeIus= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=YlvPP8gh; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf24.hostedemail.com: domain of jlayton@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726235575; h=from:from:sender: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: references:dkim-signature; bh=6lCeJIPHGmd5CjDt0lKzPSLmIOAO0h8wL1/06jupArE=; b=FhvVjJ+SYxKHipaqsxbmdQcmcWSJN2mZsaaP0lIaI1eAGEJii40hvDRw+3rdXt7M+W7sLd OEP2hWaN6mLfQ4jFkGQ6hlMDFjGlI/mpx3xUEehqNNvzya8G82gBoFkgs93uSiDB50SI+x Q1tEygz5rjx9S0HwgQczYt98OTgvtXY= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 6088FA443F4; Fri, 13 Sep 2024 13:54:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D9B7C4CEC0; Fri, 13 Sep 2024 13:54:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1726235660; bh=yUDX1L5zIhXfZWAvQGFRbCdKV8NwPBAWna+kswkxPuc=; h=From:Subject:Date:To:Cc:From; b=YlvPP8ghUUluaCjE+TMLAs0SU6H+CvMmlgnwLlYPyf4gqLyZrBKb9SsK0yAGLrW4s I5tM4aGvRjYgEBnGRvrg8n70FBva6KIonU4V83d3+kMzEy/V6sbQxAjEYd96zlJFCj Gy7M5p7ES7Zm7Ccmpg872uALvkpoUEi6oHoqS1dfhkxvykSxXHcNYEQ0hrmq8H4XYM 5iiFqPA7IFm0qTOEVF9Bj3oxNuvQZjqXCHRKjQiAeh40iVcTrCoLFxkSvxKLoW9jKH A9LpOS2KB2xLubBnfKicbcsea64INT8E1U4IZ7e8l17sIaWvn61xJhJBa1ri1ihSdc LXv3LHBTveQqA== From: Jeff Layton Subject: [PATCH v7 00/11] fs: multigrain timestamp redux Date: Fri, 13 Sep 2024 09:54:09 -0400 Message-Id: <20240913-mgtime-v7-0-92d4020e3b00@kernel.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAAFE5GYC/zXMyw6CMBCF4Vchs7amlFth5XsYFrQdYaK0ZkqIh vDuVozL/+Tk2yAiE0bosg0YV4oUfIrmlIGdBj+iIJcalFSlbPNCzONCMwolbauNdYPWCOn8ZLz R64CufeqJ4hL4fbhr/V1/RJNXf2KthRSlxsoVpXHKDJc7ssfHOfAI/b7vHyH1TRydAAAA To: John Stultz , Thomas Gleixner , Stephen Boyd , Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Jonathan Corbet , Chandan Babu R , "Darrick J. Wong" , Theodore Ts'o , Andreas Dilger , Chris Mason , Josef Bacik , David Sterba , Hugh Dickins , Andrew Morton , Chuck Lever , Vadim Fedorenko Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, Jeff Layton , Randy Dunlap X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=4945; i=jlayton@kernel.org; h=from:subject:message-id; bh=yUDX1L5zIhXfZWAvQGFRbCdKV8NwPBAWna+kswkxPuc=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBm5EQHUabYmQ8O9utWRpfIzA4y/7I7lsBUmSOsu +pMPwbszJmJAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZuREBwAKCRAADmhBGVaC Fb1XD/9d0BiHJACIE25SlsnPn+K7f8kbnu+3syFIxHlg3sQLIvQIofGPpuck3SHMGuV1N8An9kh oDmH6vImXFDl0M4RukRiKtGI0oXvPSunyHFs3otRs+rxMVlk++EIH4OMXjOsn9UHOZyZTElAyzP eEGQgKxuT3Au6NrUIgqhsaN0ZI9SAkok6P+ESk9o6eUl2f85iN4HelsdhrKcbD6tqrWcw/ufr7G oppSotRh9dJiCHPhuGUVThjE7kxjDqohEPkEtRKLN3sh3TJmj50b1YJhxK3QHJJagh1AO4IYFNm 8mfoGQTrrPPnkcUQOBNw7OkW+NYmokob8cFZDQ00xNYx95RxMnF97DkpjlbPKzvM9LlGgzRY15w o/H2jhnry24sirqS4wJn5WhrNVBMMDF4YDkBUDuMSNhGWM+dGCAYgwazVOBZveDm7ZLlp4Na+sQ 7XzTHR2Vet4vdVC24V57XWo31sTzbqF+QO86GOMyeMaO9DXYdF/jRwl7bXbVa/k7gHAreaHa/gl ofjxQgrweclwWeOaIiik7my4iTjuOieaPDN62McvgvnMTW/jGqModKBeH8WpnX/oILw2kZEHQdq TLOzsTBoATE0fehknRRBxtkpWQnTAU9O5PmdAXOVQU11NRdW/2vkjKmTLabESaqsyRP9hyMmv6T LEe/exNVGG/AHEw== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C8D02180010 X-Stat-Signature: xhkt74djfkoufeayor1ge65qafppgjfs X-Rspam-User: X-HE-Tag: 1726235661-260385 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ZELRBb4W92yAge07xM5jrrNDLoB8N/T4RT0S4oXWTjp7pELxt7M0TZ6QxTOcDaBVCIAONx9YJiqB9R7udej0zQmQTQn0hzVCpYgewY5hcMGHod3TNqsd7tm0+6yNKi819vqS/vvL5jLh1zwoHeJekCB+kWHcOiRul1Rg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Once more into the breach, dear friends! This is a replacement for the v6 series sitting in Christian's vfs.mgtime branch. For the uninitiated, the main rationale for this set is described in the changelog for patch #2. The kernel test robot reported a performance regression in v6 due to the changes to current_time(). This patchset addresses that by moving the ctime floor handling into the timekeeper code, which allows us to avoid multiple seqcount loops when fetching and converting times. The basic approach is still the same. The only difference is in where the timestamp floor is handled, and in how we get new timestamps. This reduces the changes to fs/inode.c and avoids a lot of the messiness of handling both timespec64's and ktime_t values. The pipe1_threads test shows these averages on my test rig: v6.11-rc7 103561295 (baseline) v6.11-rc7 + v6 series 95995565 (~7% slower) v6.11-rc7 + v7 series 101357203 (~2% slower) ...so the performance difference here is significant. The main difference between v6 and v7 is in the first two patches, so I've dropped the R-b's from those. The rest I left intact. Note that there is one additional patch in this series (#4) that adds support for handling delegated timestamps. The patches that make use of that are in Chuck's nfsd-next branch. Taking that in here should make that merge easier. R-b's would be welcome (particularly from the timekeeper folks). Signed-off-by: Jeff Layton --- Changes in v7: - move the floor value handling into timekeeper for better performance - Link to v6: https://lore.kernel.org/r/20240715-mgtime-v6-0-48e5d34bd2ba@kernel.org Changes in v6: - Normalize timespec64 in inode_set_ctime_to_ts - use DEFINE_PER_CPU counters for better vfs consistency - skip ctime cmpxchg if the result means nothing will change - add trace_ctime_xchg_skip to track skipped ctime updates - use __print_flags in ctime_ns_xchg tracepoint - Link to v5: https://lore.kernel.org/r/20240711-mgtime-v5-0-37bb5b465feb@kernel.org Changes in v5: - refetch coarse time in coarse_ctime if not returning floor - timestamp_truncate before swapping new ctime value into place - track floor value as atomic64_t - cleanups to Documentation file - Link to v4: https://lore.kernel.org/r/20240708-mgtime-v4-0-a0f3c6fb57f3@kernel.org Changes in v4: - reordered tracepoint fields for better packing - rework percpu counters again to also count fine grained timestamps - switch to try_cmpxchg for better efficiency - Link to v3: https://lore.kernel.org/r/20240705-mgtime-v3-0-85b2daa9b335@kernel.org Changes in v3: - Drop the conversion of i_ctime fields to ktime_t, and use an unused bit of the i_ctime_nsec field as QUERIED flag. - Better tracepoints for tracking floor and ctime updates - Reworked percpu counters to be more useful - Track floor as monotonic value, which eliminates clock-jump problem Changes in v2: - Added Documentation file - Link to v1: https://lore.kernel.org/r/20240626-mgtime-v1-0-a189352d0f8f@kernel.org --- Jeff Layton (11): timekeeping: move multigrain timestamp floor handling into timekeeper fs: add infrastructure for multigrain timestamps fs: have setattr_copy handle multigrain timestamps appropriately fs: handle delegated timestamps in setattr_copy_mgtime fs: tracepoints around multigrain timestamp events fs: add percpu counters for significant multigrain timestamp events Documentation: add a new file documenting multigrain timestamps xfs: switch to multigrain timestamps ext4: switch to multigrain timestamps btrfs: convert to multigrain timestamps tmpfs: add support for multigrain timestamps Documentation/filesystems/index.rst | 1 + Documentation/filesystems/multigrain-ts.rst | 121 +++++++++++++ fs/attr.c | 60 +++++- fs/btrfs/file.c | 25 +-- fs/btrfs/super.c | 3 +- fs/ext4/super.c | 2 +- fs/inode.c | 271 +++++++++++++++++++++++++--- fs/stat.c | 42 ++++- fs/xfs/libxfs/xfs_trans_inode.c | 6 +- fs/xfs/xfs_iops.c | 10 +- fs/xfs/xfs_super.c | 2 +- include/linux/fs.h | 36 +++- include/linux/timekeeping.h | 4 + include/trace/events/timestamp.h | 124 +++++++++++++ kernel/time/timekeeping.c | 81 +++++++++ mm/shmem.c | 2 +- 16 files changed, 717 insertions(+), 73 deletions(-) --- base-commit: da3ea35007d0af457a0afc87e84fddaebc4e0b63 change-id: 20240913-mgtime-20c98bcda88e Best regards,