Add zswap usage and compression meters#2047
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughLinux scanning now detects Zswap counters, enablement, and pool limits. Two Linux meter classes display compressed pool usage and compression statistics. Their declarations and implementations are added to the Linux build lists, and both classes are registered in the platform meter registry. Suggested labels: Suggested reviewers: Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
linux/LinuxMachine.c (1)
249-254: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueSkip
max_pool_percentwhen zswap is disabled.memory_tis 64-bit, so there’s no overflow concern here; the only gain is avoiding an unnecessary sysfs read on the disabled path.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 01a3a96d-c92f-4f51-bd27-bc15e197d3d2
📒 Files selected for processing (2)
linux/LinuxMachine.clinux/ZswapMeter.c
BenBE
left a comment
There was a problem hiding this comment.
LGTM. Only minor notes remaining; nothing critical.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
linux/LinuxMachine.c (1)
162-170: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winAvoid adding another function-like macro.
tryReadFlagduplicates parsing logic and hidesbreakcontrol flow inside a macro. Replace it with a small static helper or explicit parsing code in theZcase so the control flow remains visible.As per coding guidelines, avoid function-like macros.
Source: Coding guidelines
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 0e709f55-1cae-4f49-b7d9-15774e11bba2
📒 Files selected for processing (3)
linux/LinuxMachine.clinux/ZswapMeter.hlinux/ZswapStats.h
Initially I was thinking to move it to a function above the current function as |
@coderabbitai These function-like macros for parsing are fine when defined for a very limited, local purpose. Copying the existing macro and extending it for the task at hand is fine. @ABHIRAMSHIBU Can you rebase/squash your commits. Bug fixes to previous parts of a PR should be absorbed into where those issues were introduced. |
|
Tip For best results, initiate chat on the files or code changes.
✏️ Learnings added
|
Add bar and statistics meters for zswap pool usage, including disabled and unavailable states. Assisted-by: OpenAI Codex
593a7c8 to
fdf6309
Compare
Summary
Add Linux zswap visibility to htop without changing existing memory or swap accounting.
This introduces:
Zswapbar meter showing compressed pool usage against the configured pool limit.ZswapStatsmeter showing compressed usage, original size, and compression ratio.disabledandunavailablestates when appropriate.The pool limit is derived from the configured
max_pool_percentvalue and total system memory.Testing
make -j4make checkgit diff --check