Multigrain Timestamps Try Again For Linux 6.13 - Now With Less Performance Impact
([Linux Kernel] 6 Hours Ago
VFS Multigrain Timestamps)
- Reference: 0001507022
- News link: https://www.phoronix.com/news/Linux-6.13-Multigrain-Timestamp
- Source link:
Merged last year for Linux 6.6 was [1]multi-grain(ed) timestamps to address the current coarse-grained timestamps when updating creation time and modification time that a lot of I/O activity can happen in the once-per-jiffy timestamp. Just a few weeks in the Linux 6.6 kernel, [2]multi-grain timestamps were removed due to bugs. [3]The multigrain code went back to be reworked and now just over one year later the code has been re-merged into the mainline Linux kernel.
Christian Brauner sent out the VFS multigrain timestamp pull request last Friday and then yesterday it was merged to Linux 6.13 Git by Linus Torvalds without any fuss or further commentary. So now it's having a second chance in mainline after being improved upon. Brauner wrote in the pull request:
"This is another try at implementing multigrain timestamps. This time with significant help from the timekeeping maintainers to reduce the performance impact.
Thomas provided a base branch that contains the required timekeeping interfaces for the VFS. It serves as the base for the multi-grain timestamp work
...
Multigrain timestamps allow the kernel to use fine-grained timestamps when an inode's attributes is being actively observed via ->getattr(). With this support, it's possible for a file to get a fine-grained timestamp, and another modified after it to get a coarse-grained stamp that is earlier than the fine-grained time. If this happens then the files can appear to have been modified in reverse order, which breaks VFS ordering guarantees.
To prevent this, a floor value is maintained for multigrain timestamps. Whenever a fine-grained timestamp is handed out, record it, and when later coarse-grained stamps are handed out, ensure they are not earlier than that value. If the coarse-grained timestamp is earlier than the fine-grained floor, return the floor value instead."
See [4]this pull request of the now-merged multigrain timestamp code for Linux 6.13.
[1] https://www.phoronix.com/news/Multi-Grained-Timestamps
[2] https://www.phoronix.com/news/Linux-Revert-MG-Timestamps
[3] https://www.phoronix.com/news/Multi-Grain-Timestamps-Redux
[4] https://lore.kernel.org/lkml/20241115-vfs-mgtime-1dd54cc6d322@brauner/
Christian Brauner sent out the VFS multigrain timestamp pull request last Friday and then yesterday it was merged to Linux 6.13 Git by Linus Torvalds without any fuss or further commentary. So now it's having a second chance in mainline after being improved upon. Brauner wrote in the pull request:
"This is another try at implementing multigrain timestamps. This time with significant help from the timekeeping maintainers to reduce the performance impact.
Thomas provided a base branch that contains the required timekeeping interfaces for the VFS. It serves as the base for the multi-grain timestamp work
...
Multigrain timestamps allow the kernel to use fine-grained timestamps when an inode's attributes is being actively observed via ->getattr(). With this support, it's possible for a file to get a fine-grained timestamp, and another modified after it to get a coarse-grained stamp that is earlier than the fine-grained time. If this happens then the files can appear to have been modified in reverse order, which breaks VFS ordering guarantees.
To prevent this, a floor value is maintained for multigrain timestamps. Whenever a fine-grained timestamp is handed out, record it, and when later coarse-grained stamps are handed out, ensure they are not earlier than that value. If the coarse-grained timestamp is earlier than the fine-grained floor, return the floor value instead."
See [4]this pull request of the now-merged multigrain timestamp code for Linux 6.13.
[1] https://www.phoronix.com/news/Multi-Grained-Timestamps
[2] https://www.phoronix.com/news/Linux-Revert-MG-Timestamps
[3] https://www.phoronix.com/news/Multi-Grain-Timestamps-Redux
[4] https://lore.kernel.org/lkml/20241115-vfs-mgtime-1dd54cc6d322@brauner/
chuckula