Multigrain Timestamps Try Again For Linux 6.13 - Now With Less Performance Impact
Merged last year for Linux 6.6 was 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, multi-grain timestamps were removed due to bugs. 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:
See this pull request of the now-merged multigrain timestamp code for Linux 6.13.
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 this pull request of the now-merged multigrain timestamp code for Linux 6.13.
12 Comments