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

meminfo: fix get_total_swap_cache_pages() for RHCK #93

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

jianfenw
Copy link
Member

@jianfenw jianfenw commented Jul 9, 2024

The Linux kernel calls total_swapcache_pages() to get the total number of in-used swap cache in pages. Within corelens.meminfo, this functionality is implemented by get_total_swap_cache_pages(). In the latest RHCK kernel on OL8 (v4.18.0-513.24.1.el8_9.x86_64), the kernel uses a per-node statistics item rather than iterating through the global array "swapper_spaces" to get the sum of pages, and it has optimization that makes array "nr_swapper_spaces" and "swapper_spaces" absent, causing crashes in corelens.

This fix checks whether "NR_SWAPCACHE" exists in the set of per-node statistics items. If found, the function directly reads and returns the counter. If not, it enters the iteration as the code did previously.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jul 9, 2024
The Linux kernel calls total_swapcache_pages() to get the total number
of in-used swap cache in pages. Within corelens.meminfo, this
functionality is implemented by get_total_swap_cache_pages(). In the
latest RHCK kernel on OL8 (v4.18.0-513.24.1.el8_9.x86_64), the kernel
uses a per-node statistics item rather than iterating through the
global array "swapper_spaces" to count the sum of pages, and it has
optimization that makes array "nr_swapper_spaces" and "swapper_spaces"
absent, causing crashes in corelens.

This fix checks whether "NR_SWAPCACHE" exists in the set of per-node
statistics items. If found, the function directly reads and returns the
counter. If not, it enters the iteration as the code did previously.

Signed-off-by: Jianfeng Wang <[email protected]>
@jianfenw jianfenw force-pushed the jianfenw-meminfo-rhck-fix branch from 3a2c93c to 361d11c Compare July 9, 2024 20:58
@brenns10 brenns10 merged commit 7642f35 into oracle-samples:main Jul 9, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants