Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from jmencak/cpu-partitioning
Add preliminary support for the cpu-partitioning profile.
- Loading branch information
Showing
8 changed files
with
110 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,33 @@ | ||
Workaround for a child profile variable expansion in parent's | ||
[variables] section. | ||
|
||
Resolves rhbz#1781664 | ||
|
||
See: https://github.com/redhat-performance/tuned/pull/239 | ||
|
||
diff --git a/profiles/cpu-partitioning/tuned.conf b/profiles/cpu-partitioning/tuned.conf | ||
index 1821b74e..56977500 100644 | ||
--- a/usr/lib/tuned/cpu-partitioning/tuned.conf | ||
+++ b/usr/lib/tuned/cpu-partitioning/tuned.conf | ||
@@ -10,6 +10,10 @@ include=network-latency | ||
include=/etc/tuned/cpu-partitioning-variables.conf | ||
|
||
isolated_cores_assert_check = \\${isolated_cores} | ||
+# Make sure isolated_cores is defined before any of the variables that | ||
+# use it (such as assert1) are defined, so that child profiles can set | ||
+# isolated_cores directly in the profile (tuned.conf) | ||
+isolated_cores = ${isolated_cores} | ||
# Fail if isolated_cores are not set | ||
assert1=${f:assertion_non_equal:isolated_cores are set:${isolated_cores}:${isolated_cores_assert_check}} | ||
|
||
@@ -22,6 +26,10 @@ not_isolated_cores_expanded=${f:cpulist_invert:${isolated_cores_expanded}} | ||
isolated_cores_online_expanded=${f:cpulist_online:${isolated_cores}} | ||
not_isolated_cores_online_expanded=${f:cpulist_online:${not_isolated_cores_expanded}} | ||
not_isolated_cpumask=${f:cpulist2hex:${not_isolated_cores_expanded}} | ||
+# Make sure no_balance_cores is defined before | ||
+# no_balance_cores_expanded is defined, so that child profiles can set | ||
+# no_balance_cores directly in the profile (tuned.conf) | ||
+no_balance_cores=${no_balance_cores} | ||
no_balance_cores_expanded=${f:cpulist_unpack:${no_balance_cores}} | ||
|
||
# Fail if isolated_cores contains CPUs which are not online |
This file contains 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,28 @@ | ||
Enable multiple profile inheritance. | ||
|
||
[main] | ||
include=profile1;profile2 | ||
|
||
Also comma "," can be used instead of the semicolon ";". | ||
No escaping is done, so it's assumed there will be no comma or semicolon | ||
in the profile name. | ||
|
||
Signed-off-by: Jaroslav Skarvada <jskarvad@redhat.com> | ||
|
||
See: https://github.com/redhat-performance/tuned/commit/feb6e8b6f4fd3c1b1595fc52c8b0868a2460a819 | ||
|
||
diff --git a/tuned/profiles/loader.py b/tuned/profiles/loader.py | ||
index df7bd9e4..e844472f 100644 | ||
--- a/usr/lib/python2.7/site-packages/tuned/profiles/loader.py | ||
+++ b/usr/lib/python2.7/site-packages/tuned/profiles/loader.py | ||
@@ -78,8 +78,8 @@ def _load_profile(self, profile_names, profiles, processed_files): | ||
config = self._load_config_data(filename) | ||
profile = self._profile_factory.create(name, config) | ||
if "include" in profile.options: | ||
- include_name = self._variables.expand(profile.options.pop("include")) | ||
- self._load_profile([include_name], profiles, processed_files) | ||
+ include_names = re.split(r"\b\s*[,;]\s*", self._variables.expand(profile.options.pop("include"))) | ||
+ self._load_profile(include_names, profiles, processed_files) | ||
|
||
profiles.append(profile) | ||
|
This file contains 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 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,22 @@ | ||
apiVersion: tuned.openshift.io/v1 | ||
kind: Tuned | ||
metadata: | ||
name: openshift-cpu-partitioning | ||
namespace: openshift-cluster-node-tuning-operator | ||
spec: | ||
profile: | ||
- data: | | ||
[main] | ||
summary=Configuration for cpu-partitioning | ||
include=openshift-node,cpu-partitioning | ||
[variables] | ||
# {isolated,no_balance}_cores take a list of ranges; e.g. isolated_cores=2,4-7 | ||
isolated_cores=1 | ||
no_balance_cores=1 | ||
name: openshift-cpu-partitioning | ||
recommend: | ||
- match: | ||
- label: node-role.kubernetes.io/worker-rt | ||
priority: 30 | ||
profile: openshift-cpu-partitioning |