From patchwork Wed Oct 2 21:27:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 13820395 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 63CA3CF8542 for ; Wed, 2 Oct 2024 21:27:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 570CA6B03C5; Wed, 2 Oct 2024 17:27:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4CFD36B03C4; Wed, 2 Oct 2024 17:27:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3237E6B03C0; Wed, 2 Oct 2024 17:27:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 084066B03B6 for ; Wed, 2 Oct 2024 17:27:43 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A525412113C for ; Wed, 2 Oct 2024 21:27:43 +0000 (UTC) X-FDA: 82629949206.19.7DD50B4 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id C78CD20005 for ; Wed, 2 Oct 2024 21:27:41 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tcXFxU3o; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=jlayton@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727904440; a=rsa-sha256; cv=none; b=G/Ygkz37gRrASjK0yNqheBhsX1SabEB/KDOTwpAeSLCIFx6rdzFWoAtHQ4M9bDks8oEoAt T45RaX97riyEZ5RIs2IZlvD34+OEba20mn6q6ORZVkIsJ88YT1TIkTpYURluFsEj5d5bfm bO19jmRJe2leUPq7AMMuO5NOnNgtFWY= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=tcXFxU3o; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of jlayton@kernel.org designates 139.178.84.217 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=1727904440; 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=ErMeseH+az8SohFlZPHfuz/4TLzjEryf0L2P6cDAZ2E=; b=7jfi9bEkRCYcH7brhajUhyR5WOlsulUkUwxf+/4Ro1rJpoeiKg/5k7hZdMJioTrgqM81jL 5ajsJc19zSD0MNke3if9ScTZTg6eRMmOq9G//hpUFxAGAq5iJUjz8V8MdLgvpNZ19AjYBS EWvh6fD7Biau7uyMuGdbt0ssQjigetY= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 3E3FB5C0FF3; Wed, 2 Oct 2024 21:27:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7406C4CEC2; Wed, 2 Oct 2024 21:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727904451; bh=Y5NHoq1D66E6MhHGAOXPO50U8Tj9wg921VuqUM47n1c=; h=From:Subject:Date:To:Cc:From; b=tcXFxU3ofaRyX9PSIuU+dnEpVSM/iumnaLK9a5v7TRdkrtwP0QNqH27GmUbZcI1tG oYge+zigzJPA1JlMSEgw/KdA581RhzhSY2EXPXC24TcYb/fxHkk2JC3p2pYVf1dhpl uTFc8CnIho9ca+o5HduPQWYL6McWHSds7sm+jMg4ijNCAepuwpa0wEE1g2kauctk49 DSHzGyfbIwqSARHG+mFXPk12jQQ8+Dr9gm/lQDr2W7vbZjlbkISYQgNfSimTqXm91W EFckdWyhiqKZgr9kr2ycRGM1jRvMAK9cowQ98S4qExt0fLZE2bvIhe3zvSgP6dO3wS GGNPr5QZTTZCg== From: Jeff Layton Subject: [PATCH v10 00/12] timekeeping/fs: multigrain timestamp redux Date: Wed, 02 Oct 2024 17:27:15 -0400 Message-Id: <20241002-mgtime-v10-0-d1c4717f5284@kernel.org> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIALO6/WYC/2XOSw7CIBCA4asY1mKGRwu48h7GBY+xErU11BCN6 d2lNVaNy5nw/cOD9Jgi9mS9eJCEOfaxa8vAYLkg/mDbBmkMZUE4cAmGCXpurvGMlIM32vlgtUZ SHl8S7uNtKm13ZT7E/tql+xTO9bh9JRSr3olcU6BSYxWEdIE7uzliavG06lJDxkZWH/d1OqviD A8SOKBwAH9Oz44BsNnp0YEQUgTDnBd/znw7PjtTnFJYfmhDpaz/ccMwPAGOhG0LRgEAAA== X-Change-ID: 20240913-mgtime-20c98bcda88e To: John Stultz , Thomas Gleixner , Stephen Boyd , Alexander Viro , Christian Brauner , Jan Kara , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Jonathan Corbet , Randy Dunlap , 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 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5223; i=jlayton@kernel.org; h=from:subject:message-id; bh=Y5NHoq1D66E6MhHGAOXPO50U8Tj9wg921VuqUM47n1c=; b=owEBbQKS/ZANAwAIAQAOaEEZVoIVAcsmYgBm/bq5Ucxpe+2dO/4f2N9Del8gbRSKkXWJ4RxvE m32RFAxn22JAjMEAAEIAB0WIQRLwNeyRHGyoYTq9dMADmhBGVaCFQUCZv26uQAKCRAADmhBGVaC FbJjD/4ich0/NyeGFTRSWS1TM6qXVjXQ8xiLD/NLSZ2ncXBcG3V1hR+AI5b74oW1NMX++R6i4gB T4DeOOvnUvb9hYQzATPVtCEMnTs/zmfiO+2KdNNNMT+l8TLfGQ/lZcLoVOxLDKMz9AFbDkAeSr7 c6kjXrU0eBwUVT1gDRxmqojgNY+HGQe2vLNRFERnBRe3NDtNi+MCmot32asaXK/7KvjnrwEjzHz 3x6+s9pu0nlJw7d6H/Lb5KvbeyTDrqckDBjXOC1nJp4C8fKnAxYBYVjP4cUtlkwTWwr20hD+Rwd mnjXCPtQ3ATyHOir3Y3b6y2/YdxjR990iPnP2Xc5w2JgpskMUhEtm5SnjP0BnOzBlpnl0kHALXj Eh85QVu4qubOl+4hGsJ9EL7CKh0CVckteSwd3EVlAM7AkGJhn03xeplu/pt7S/R9QtQbkWQxlct wjg9ADGhboyjclGC6lU1GYHkz1nYOy75cd5gEpOKN/j5Xg4eKN6tuBYJQTi1J+5vtMfhZBeDs3J PTh40/58qSFsYQcSbNKZCoXKa5UPTkcFRQwGEFhU9rEbPH9N6wSthLdJECY/UWrNYW1DtxceroA D8dDhy1XDRaUnAsnroLHI9/TPzjvO5y1al84sZ8El7GNodyr9+ILoihcGqtO8dQm/l7WS7BU4dS x01qjjvjnCAepRQ== X-Developer-Key: i=jlayton@kernel.org; a=openpgp; fpr=4BC0D7B24471B2A184EAF5D3000E684119568215 X-Rspam-User: X-Stat-Signature: pb1efjcxc1n4daxinhcwqihf19cd6jpy X-Rspamd-Queue-Id: C78CD20005 X-Rspamd-Server: rspam02 X-HE-Tag: 1727904461-506627 X-HE-Meta: U2FsdGVkX18KX4qxud6oqRv4YMRAxLoz24Oz79/1RvtGJlIA/RarZ6HR3fg/MVmvnAn+vhJ+QdGos1GbvUCFel4Uk8D5LkXlN7MfvhJeX6sUSEU1xemvGZbenEFsy/tJSLegyYf1GPsPfPaMnIDZfuCy7Sj9GLIhZBqI8EGBgiNgPiluEZ4vTbNw4+WNXVdXaYv2NC2YK6lh6QwDegFEB8lXg4GwHgRmKk8LHLG9ZJWF/comCdTn8CnkH7Fqmk39pN4lOxCr2NBvKKnohg2SEH1fUCt0OyqHkF1XJlnsDECK9ttNmg37hxKR6LbFsb815WZ0I80eNcpNoAYXUGVwbX6RafdvnatbOD50ie4m2qmxe7tTyBRGZepMvU4QOeEOe9HpLSUxe/uPVuWDmoTHUJ++S2MV0ePcPGQY8i5+dM7NSiepLfs3pjHM7YmEpWckGT9vXGmDKe8B5eJgTeoFGxqWedMCmWW6fQuUKX9LQJ2Po68KLrdoR1IphGQzMoMduwJpBKgFtA8FowXVNWiItZVEcCshIq9Q2boIq6/k66PMvQDgePA7c96O9/q4H+wg6DUA/O6pQ7fB2cGbRj4HHRqYm/FKvGjgyaU7cbTh0djLvG4fwguklyM92HXd+E74gM/fxBBw6jR7UlIinwqAEd1n4CPDxCLDWblv/leAV1aw9soqfQFNL1ngODzXL/onx3csXYc2Mi5r1JoBPn1n12maMdjhfzdXWKg65m0+38BwM8/z/+qxn0Zrom063yPixfcVAdoavKCk1CReBGsXCMUYVkAAFwwkmACJ9pC+QcNQqBg9t/y0Gb5hmg3htmE0xtb/KymvrJpE2klnsNqYBM414/40iFsgPisQb5CPl96WjL75ETyM7QlQ+xaj37YrFnFtpFeksmLvRs/xMtTxuCDXuPL5ldhNc9CKvDZ3dRoE1I173LTgu/WuimiVeiXnr50dGopyAUUuOGu13IG HUAkMzn5 F3lk68DUN6LUhj01qRHsDC8IgrrdJLMjcAGN2f+alBbA/rHeXAWNp1d17TfjYXTX9RqZTosVtacLxUw4BLNjYoY7L+W2Oa4uv8GMS3FfwJ9Z3AJBqhs/LyUqOhZCETNwsEHa3f+7v0Jmrd/fGZdmi4kkAtqTFLCGyhYCOvD2yTubckrXMjqMa6n8qnHisVN+MSZs3kd/SmM/SLjkhpQMdsRqX3cYuO/sGd056JOKx6KRksQCMxZxJOmHH0w== 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: This is a replacement for the v6 series sitting in Christian's vfs.mgtime branch. The main changes here are to the changelogs, documentation and comments. I've also moved the timekeeping patches to the front of the series, and done some minor cleanups. The pipe1_threads test shows these averages on my test rig with this series: v6.11: 89233600 (baseline) v6.11 + v9 series: 88460897 (<1% slower) Thanks for all of the review so far! Signed-off-by: Jeff Layton --- Changes in v10: - Reorder timekeeping patches to front of series - Better separate timekeeping and fs changes - add data_race annotations to per_cpu fetches - get rid of pointless test for unsigned long to go negative - better spacing for declarations and definitions in timekeeping_internal.h - minor style cleanups - Link to v9: https://lore.kernel.org/r/20241002-mgtime-v9-0-77e2baad57ac@kernel.org Changes in v9: - Comment and documentation cleanups. - Drop the EXPORT_SYMBOL_GPL() from new timekeeper interfaces - Link to v8: https://lore.kernel.org/r/20241001-mgtime-v8-0-903343d91bc3@kernel.org Changes in v8: - split patch that adds percpu counters into fs and timekeeping patches - convert percpu counters to unsigned longs - directly access the offs_real value in timekeeper instead of going through offsets array - drop WARN_ON's in timekeeping patches - better changelogs and more comments for the timekeeping bits - better document how backward realtime clock jumps affect things - Link to v7: https://lore.kernel.org/r/20240913-mgtime-v7-0-92d4020e3b00@kernel.org 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 (12): timekeeping: add interfaces for handling timestamps with a floor value timekeeping: add percpu counter for tracking floor swap events 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 | 125 ++++++++++++ fs/attr.c | 60 +++++- fs/btrfs/file.c | 25 +-- fs/btrfs/super.c | 3 +- fs/ext4/super.c | 2 +- fs/inode.c | 282 +++++++++++++++++++++++++--- fs/stat.c | 46 ++++- 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 | 5 + include/trace/events/timestamp.h | 124 ++++++++++++ kernel/time/timekeeping.c | 106 +++++++++++ kernel/time/timekeeping_debug.c | 14 ++ kernel/time/timekeeping_internal.h | 15 ++ mm/shmem.c | 2 +- 18 files changed, 791 insertions(+), 73 deletions(-) --- base-commit: 98f7e32f20d28ec452afb208f9cffc08448a2652 change-id: 20240913-mgtime-20c98bcda88e Best regards,