Repository navigation
Conversation
Closes: troglobit#25 Signed-off-by: berringtoni36-commits <berringtoni36-commits@users.noreply.github.com>
troglobit
left a comment
There was a problem hiding this comment.
Sorry for the late review, I've been swamped with work this past week.
Thanks for picking up #25! It builds cleanly here and make check passes. A few things before I merge:
-
The docs get the threshold units wrong. The code divides the PSI value by 100, so
warning = 0.10means 10%, not "0.10 percent" asdoc/features.mdsays. This also means the examplecritical = 1.00(100%) can never trigger. Please fix the examples inwatchdogd.conf,watchdogd.conf.5andfeatures.md, e.g.critical = 0.50. -
conf_parse_file()ignores the return value frompressure_checker(). With an invalidscopeorwindowon SIGHUP,pressure_init()returns before touching the timer, so the monitor keeps running with the old settings and only logs an error. It should stop the monitor and pass the error on. -
The parser is a lot of code for a two-line file. Something like the
sscanf()approach inmeminfo.cwould be enough, and then the separate parser files and the unit test could go. The strict checks also make it fragile: an unexpected line from a future kernel fails the whole read.
Nits:
- Please add a
ChangeLog.mdentry. src/pressure-test.cis missing a license header, and it hardcodes/tmpinstead of using$TMPDIR. (Moot if the test goes away.)- The man page example has
enabled = true, butwatchdogd.confhas it commented out. - WARN/EMERG log the fraction (
0.12 > 0.10) while INFO/DEBUG log percent. Percent everywhere would match/proc/pressure/memory.
Thanks again!
Correct fraction thresholds and percentage logging, and keep the sample configuration disabled consistently. Stop the previous timer before validating reload settings and propagate pressure initialization errors through conf_parse_file(). Use a small sscanf loop in pressure.c, ignoring unknown PSI lines, instead of maintaining separate parser and unit-test files. Add a ChangeLog entry. Host callback and reload checks pass with UBSan. Full Linux integration and target hardware have not been retested for this revision.
|
Thanks for the review! I've corrected the threshold examples ( The monitor now stops its previous timer before validating a replacement configuration, and I've replaced the standalone parser with an Validation: 93 host checks covering scopes/windows, thresholds, missing/malformed metrics, an extra future PSI line, and reload failures pass with UBSan. The original revision fails 14 of these checks. I have not rerun the full Linux autotools build locally for this update. |
|
Merged to master as a single commit, thank you for your work on this and for addressing the review so quickly! Before merging I squashed the two commits and made a few small changes:
Tested on target with stress-ng, and the warning and critical script actions trigger as expected. Thanks again! |
Add an optional Linux PSI memory pressure monitor (
--with-pressure) reading/proc/pressure/memory. Selectsomeorfullandavg10,avg60, oravg300, then compare against warning and critical thresholds expressed as fractions (0.10= 10%). The monitor is disabled by default.PSI parsing uses a small
sscanf()loop inpressure.c. Unknown lines are skipped; an unavailable or invalid selected metric skips that poll. Invalid scope/window settings stop the previous monitor on reload and propagate an initialization error fromconf_parse_file().Includes configuration, documentation, build integration, and a ChangeLog entry. Logs display percent; script arguments use fractions, consistent with other monitors.
Validation for the updated revision:
-Wall -Wextra -Werrorand UBSan, covering the production PSI callback, initialization, and extracted configuration functions with mocked timers/configuration dependencies. The original revision fails 14 of these checks.git diff --checkpasses; the complete updated PR applies to current upstream master.AI assistance was used to prepare this update and its host validation.
Closes #25