Skip to content
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

tools/readahead compatible with kernel version >= 5.10 #3507

Conversation

chenyuezhou
Copy link
Contributor

After kernel version 5.10, __do_page_cache_readahead was renamed to /do_page_cache_ra https://patchwork.kernel.org/project/linux-fsdevel/patch/20200903140844.14194-5-willy@infradead.org/

Comment on lines 27 to 33
if version[0] > major:
return True
if version[0] < major:
return False
if minor and version[1] < minor:
return False
return True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return (version[0], version[1]) > (major, minor)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! adjusted.

from time import sleep
import ctypes as ct
import argparse

# arguments
examples = """examples:
./readahead -d 20 # monitor for 10 seconds and generate stats
./readahead -d 20 # monitor for 10 seconds and generate stats
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

20 and 10 don't match.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted.

if kernel_version_ge(5, 10):
ra_event = "do_page_cache_ra"
b.attach_kprobe(event=ra_event, fn_name="entry__do_page_cache_readahead")
b.attach_kretprobe(event=ra_event, fn_name="exit__do_page_cache_readahead")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let us just do first try attach_kprobe with __do_page_cache_readahead(), if failed, try do_page_cache_ra(). You can look at nfsdist.py as an example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, adjutsted.

@yonghong-song
Copy link
Collaborator

[buildbot, test this please]

@yonghong-song yonghong-song merged commit 97c2076 into iovisor:master Jun 25, 2021
brho pushed a commit to brho/bcc that referenced this pull request Nov 3, 2021
After kernel version 5.10, __do_page_cache_readahead() was renamed to do_page_cache_ra(),
let us try both in readahead.py.
ismhong pushed a commit to ismhong/bcc that referenced this pull request Dec 6, 2021
After kernel version 5.10, __do_page_cache_readahead() was renamed to do_page_cache_ra(),
let us try both in readahead.py.
ismhong pushed a commit to ismhong/bcc that referenced this pull request Dec 6, 2021
After kernel version 5.10, __do_page_cache_readahead() was renamed to do_page_cache_ra(),
let us try both in readahead.py.
CrackerCat pushed a commit to CrackerCat/bcc that referenced this pull request Jul 31, 2024
After kernel version 5.10, __do_page_cache_readahead() was renamed to do_page_cache_ra(),
let us try both in readahead.py.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants