-
Notifications
You must be signed in to change notification settings - Fork 38.8k
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
getPids - don't recursively traverse every dir in /proc #66367
Conversation
@lanchongyizu: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
pkg/util/procfs/procfs_linux.go
Outdated
} | ||
|
||
// The bytes we read have '\0' as a separator for the command line | ||
parts := bytes.SplitN(cmdline, []byte{0}, 2) | ||
if len(parts) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/kubernetes/kubernetes/pull/66367/files#diff-815325f4d4776cc2282858482b77d5f5R134
Should be continue
rather than return
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch.
@@ -140,12 +142,10 @@ func getPids(re *regexp.Regexp) []int { | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`filepath.Walk` recursively traverses every dir, which is not what is needed for getPids. Instead only read the list of dirs in the top level of `/proc`. ``` benchmark old ns/op new ns/op delta BenchmarkGetPids-4 868684 195522 -77.49% ```
Updated, also optimized in case of many entries in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@xiaoxubeii PTAL |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
still valid |
/test all |
Would it be simpler to make a more surgical change? Something like:
|
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cpuguy83, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Did some quick tests, this is better and complete |
🎉 Thanks! |
What this PR does / why we need it:
filepath.Walk
recursively traverses every dir, which is not what isneeded for
getPids
.Instead only read the list of dirs in the top level of
/proc
.