chore(gov): clean slice w2p1 governor (P1 surface)#62
chore(gov): clean slice w2p1 governor (P1 surface)#62heidi-dang wants to merge 6 commits intomainfrom
Conversation
- Add GOV_APPLY schema with strict linear JSON parser (<=512B payload) - Add ACK/NACK codes for validation errors - Implement RuleSet POD structures (cpu/mem/pids/rlim/oom_score_adj) - Add bounded ingress queue (256 capacity) with backpressure - Implement ProcessGovernor with apply loop - Implement affinity (sched_setaffinity), nice (setpriority), rlimits (prlimit RLIMIT_NOFILE/RLIMIT_CORE), oom_score_adj - Add 20 unit tests for parser (passes 20/20)
… adjust tests to P1 API; add procfs starttime helper
Summary of ChangesHello @heidi-dang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates a cleaned-up cherry-pick of the initial process resource governor (P1 surface) and resolves recent refactor conflicts. The changes primarily focus on refining existing test cases to align with the current P1 API and ensuring robustness in process capability handling, without introducing any new behavioral changes to ProcCap or JobRunner. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a cleanup of a cherry-pick for the process resource governor. The changes are minor, including fixing a test data string for parsing /proc/pid/stat, removing a blank line, and adding a new test for backward compatibility. The changes look good overall. I've suggested an improvement to the new test to make it more robust and avoid redundancy with an existing test.
| TEST_F(GovApplyParserTest, ParseV1BackwardCompat) { | ||
| auto result = parse_gov_apply(R"({"pid":1234,"cpu":{"affinity":"0-3"}})"); | ||
| EXPECT_TRUE(result.success); | ||
| // P1 API: payloads without explicit version are treated as V1; no version field present. | ||
| } |
There was a problem hiding this comment.
This test appears to be redundant with ParsePidWithCpuAffinity as it uses the same input payload. While the test name and comment are useful for documenting the backward compatibility behavior, the test itself only asserts result.success.
To make this test more robust and not just a subset of an existing test, consider adding assertions to verify the parsed values, similar to what is done in ParsePidWithCpuAffinity.
TEST_F(GovApplyParserTest, ParseV1BackwardCompat) {
auto result = parse_gov_apply(R"({"pid":1234,"cpu":{"affinity":"0-3"}})");
EXPECT_TRUE(result.success);
EXPECT_EQ(result.msg.pid, 1234);
ASSERT_TRUE(result.msg.cpu.has_value());
ASSERT_TRUE(result.msg.cpu->affinity.has_value());
EXPECT_EQ(*result.msg.cpu->affinity, "0-3");
// P1 API: payloads without explicit version are treated as V1; no version field present.
}
This PR applies a small, cleaned cherry-pick of the initial process resource governor (P1 surface) and resolves conflicts introduced by recent refactors. Changes: - cherry-pick of initial governor code (gov_rule.h, process_governor.*) - Adjust tests to match current P1 API - Add/keep procfs_starttime helper for proc-cap robustness Verification: local Release build + ctest all passed except CI to run remote checks.\n\nNo behavioral changes to ProcCap or JobRunner beyond the existing merged helper and spawn PGID observation. (Small test-only adjustments to keep compatibility.)