-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Linux 5.18+] Fix detection of filemap_range_has_page #16034
Conversation
In v5.18 `filemap_range_has_page` moved to `pagemap.h` `pagemap.h` has been around since 3.10 so just include both Signed-off-by: Robert Evans <evansr@google.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that stinks. Good find.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well that's unfortunate, thanks for the fix.
Given the noticeable performance improvement and visual safety of the change, wouldn't it be nice to cherry-pick it to v2.2.4? |
Seems reasonable to backport with the caveat that this code path hasn't been exercised in recent kernels. |
In v5.18 `filemap_range_has_page` moved to `pagemap.h` `pagemap.h` has been around since 3.10 so just include both Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rob Norris <robn@despairlabs.com> Signed-off-by: Robert Evans <evansr@google.com> Closes #16034
In v5.18 `filemap_range_has_page` moved to `pagemap.h` `pagemap.h` has been around since 3.10 so just include both Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Rob Norris <robn@despairlabs.com> Signed-off-by: Robert Evans <evansr@google.com> Closes openzfs#16034
Motivation and Context
While testing #16031, I noted that
HAVE_FILEMAP_RANGE_HAS_PAGE
is not being defined for Linux 6.5 or 6.6.Turns out the symbol moved in v5.18 from
fs.h
topagemap.h
, and the fallback path has been in use for all versions of Linux since then.For the history of the symbol, run from linux git repo:
I also verified this by compiling the test src at all major releases from v5.18 ... v6.8 and v6.9-rc1
In the fallback path, ZFS calls
mappedread
andupdate_pages
for every read or write (respectively) after the first mmap call to the file. This is unnecessary for unmapped ranges and has a slight performance cost.Edit: The cost maybe isn't so slight. The fallback code within
mappedread
only reads in page-sized increments which is somewhat unfortunate. See #16031 (comment)Description
In v5.18
filemap_range_has_page
moved topagemap.h
pagemap.h
has been around since 3.10 so just include bothHow Has This Been Tested?
Local ZTS passes (linux.run, common.run, and sanity.run) on 6.6.8-200.fc39.x86_64 w/ debug build
This is not without risk since the non-fallback path has been disabled for a long while
I don't have a test setup that can build against older kernels.
Types of changes
Checklist:
Signed-off-by
.