-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8331560: Refactor Hotspot container detection code so that subsystem delegates to controllers #19085
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
Closed
jerboaa
wants to merge
47
commits into
openjdk:master
from
jerboaa:jdk-8331560-cgroup-controller-delegation
Closed
8331560: Refactor Hotspot container detection code so that subsystem delegates to controllers #19085
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
eda2aa9
8302744: Refactor Hotspot container detection code
jerboaa e659a67
Refactor cgroup controller code
jerboaa 3769ef3
Fix whitespace
jerboaa 6c88f9f
Merge branch 'master' into jdk-8302744-cleanup-getcontainer-info
jerboaa 3358c5b
Add generic julong/char* read functions
jerboaa 09521e5
Add basic testing for read functions
jerboaa 6a81344
Add key-value read function
jerboaa 6ce5c55
Try a different approach.
jerboaa f368d54
Handle cpu quota for cgroups v1 specially
jerboaa 4de2adb
Fix whitespace
jerboaa 9ac1b40
Fix TestMemoryAwareness for cgroup v2
jerboaa 8d5d0a4
Merge branch 'pr/19060' into jdk-8331560-cgroup-controller-delegation
jerboaa b0c3a72
Fix limit_from_str usages
jerboaa 5d20a2d
More fix-ups after merge
jerboaa fec9d9a
Merge branch 'master' into jdk-8302744-cleanup-getcontainer-info
jerboaa 7da8791
Use enum class for TupleValue
jerboaa d3e827f
Get rid of the templated function
jerboaa 808ec10
Fix general read string cases.
jerboaa b4fcf1d
Add convenience function for 'max' handling
jerboaa 328390d
Add a test for a large string read
jerboaa c41d318
Add proper comments for parsing utility functions
jerboaa e8603c2
Merge branch 'jdk-8302744-cleanup-getcontainer-info' into jdk-8331560…
jerboaa 9477fd2
Remove limit_from_str from util class
jerboaa b085574
Resolve ambiguity with static_cast
jerboaa bd2ad62
Merge branch 'master' into jdk-8331560-cgroup-controller-delegation
jerboaa 93c52ec
Fixup after merge
jerboaa 8b97280
Fix inheritance hierarchy
jerboaa cb91f4c
Appropriately handle version specific printing
jerboaa ad62e16
Clean up
jerboaa e177a08
Review feedback
jerboaa b26f188
Merge branch 'master' into jdk-8331560-cgroup-controller-delegation
jerboaa cc819f2
Get rid of multiple inheritance
jerboaa 2c067dd
Style nit
jerboaa 5d7537f
initializer lists
jerboaa 2e2b4eb
Templated class use references
jerboaa 6aff207
Tabs
jerboaa 467018f
Review feedback
jerboaa abf0adc
Rename log function
jerboaa 48494f6
Merge branch 'master' into jdk-8331560-cgroup-controller-delegation
jerboaa 883be8c
Merge branch 'master' into jdk-8331560-cgroup-controller-delegation
jerboaa be3c15b
Use references when passing in readers
jerboaa 20ad401
Remove declaration from sub-classes that are implemented in super class
jerboaa 65a396d
Helper function naming fixes
jerboaa 30fa617
Add comment about un-used-ness
jerboaa 35411e8
Merge branch 'master' into jdk-8331560-cgroup-controller-delegation
jerboaa dcd0554
Fixes after merge
jerboaa 77cf2ea
Fix tabs => spaces
jerboaa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| /* | ||
| * Copyright (c) 2024, Red Hat, Inc. | ||
| * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| * | ||
| * This code is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU General Public License version 2 only, as | ||
| * published by the Free Software Foundation. | ||
| * | ||
| * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| * version 2 for more details (a copy is included in the LICENSE file that | ||
| * accompanied this code). | ||
| * | ||
| * You should have received a copy of the GNU General Public License version | ||
| * 2 along with this work; if not, write to the Free Software Foundation, | ||
| * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| * | ||
| * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| * or visit www.oracle.com if you need additional information or have any | ||
| * questions. | ||
| * | ||
| */ | ||
|
|
||
| #include "cgroupUtil_linux.hpp" | ||
|
|
||
| int CgroupUtil::processor_count(CgroupCpuController* cpu_ctrl, int host_cpus) { | ||
| assert(host_cpus > 0, "physical host cpus must be positive"); | ||
| int limit_count = host_cpus; | ||
| int quota = cpu_ctrl->cpu_quota(); | ||
| int period = cpu_ctrl->cpu_period(); | ||
| int quota_count = 0; | ||
| int result = 0; | ||
|
|
||
| if (quota > -1 && period > 0) { | ||
| quota_count = ceilf((float)quota / (float)period); | ||
| log_trace(os, container)("CPU Quota count based on quota/period: %d", quota_count); | ||
| } | ||
|
|
||
| // Use quotas | ||
| if (quota_count != 0) { | ||
| limit_count = quota_count; | ||
| } | ||
|
|
||
| result = MIN2(host_cpus, limit_count); | ||
| log_trace(os, container)("OSContainer::active_processor_count: %d", result); | ||
| return result; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| /* | ||
| * Copyright (c) 2024, Red Hat, Inc. | ||
| * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| * | ||
| * This code is free software; you can redistribute it and/or modify it | ||
| * under the terms of the GNU General Public License version 2 only, as | ||
| * published by the Free Software Foundation. | ||
| * | ||
| * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| * version 2 for more details (a copy is included in the LICENSE file that | ||
| * accompanied this code). | ||
| * | ||
| * You should have received a copy of the GNU General Public License version | ||
| * 2 along with this work; if not, write to the Free Software Foundation, | ||
| * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| * | ||
| * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| * or visit www.oracle.com if you need additional information or have any | ||
| * questions. | ||
| * | ||
| */ | ||
|
|
||
| #ifndef CGROUP_UTIL_LINUX_HPP | ||
| #define CGROUP_UTIL_LINUX_HPP | ||
|
|
||
| #include "utilities/globalDefinitions.hpp" | ||
| #include "cgroupSubsystem_linux.hpp" | ||
|
|
||
| class CgroupUtil: AllStatic { | ||
|
|
||
| public: | ||
| static int processor_count(CgroupCpuController* cpu, int host_cpus); | ||
| }; | ||
|
|
||
| #endif // CGROUP_UTIL_LINUX_HPP |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.