<div dir="ltr">Hi,<div><br></div><div style>Should DefaultOOMScore= and DefaultLimit***= be really under [Manager]? Wouldn't it be better to have an [Exec] section. Or even have [Service], [Mount],.. sections that can give separate configuration per exec unit. </div>
<div style><br></div><div style>Other idea would be having both [Manager] and [Service], [Mount], .. where configuration directives in [Service] overrides [Manager]. This way, one can specify a top level configuration under [Manager] and overwrite it per exec unit.</div>
<div style><br></div><div style>Also, there are many configuration options per exec units that are not in the system.conf. Are we open taking patches on completing missing configuration options?</div><div style><br></div>
<div style>Thanks</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Apr 27, 2013 at 4:49 PM, Sangjung Woo <span dir="ltr"><<a href="mailto:again4you@gmail.com" target="_blank">again4you@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">If 'OOMScoreAdjust' option is ommited from unit file, this patch makes<br>
the executed process's oom_score_adj as default OOM score in case of<br>
explicitly 'DefaultOOMScore' is declared in configuration file.<br>
(i.e. system.conf and user.conf)<br>
<br>
If the unit file has 'OOMScoreAdjust' option, set the its oom_score_adj<br>
as declared value as before.<br>
<br>
Signed-off-by: Sangjung Woo <<a href="mailto:again4you@gmail.com">again4you@gmail.com</a>><br>
---<br>
src/core/main.c | 8 ++++++++<br>
src/core/system.conf | 1 +<br>
src/core/user.conf | 1 +<br>
3 files changed, 10 insertions(+)<br>
<br>
diff --git a/src/core/main.c b/src/core/main.c<br>
index 22cec4e..e8bb015 100644<br>
--- a/src/core/main.c<br>
+++ b/src/core/main.c<br>
@@ -90,6 +90,7 @@ static bool arg_confirm_spawn = false;<br>
static bool arg_show_status = true;<br>
static bool arg_switched_root = false;<br>
static char **arg_default_controllers = NULL;<br>
+static char *arg_default_oom_score = NULL;<br>
static char ***arg_join_controllers = NULL;<br>
static ExecOutput arg_default_std_output = EXEC_OUTPUT_JOURNAL;<br>
static ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT;<br>
@@ -641,6 +642,7 @@ static int parse_config_file(void) {<br>
{ "Manager", "DefaultStandardOutput", config_parse_output, 0, &arg_default_std_output },<br>
{ "Manager", "DefaultStandardError", config_parse_output, 0, &arg_default_std_error },<br>
{ "Manager", "JoinControllers", config_parse_join_controllers, 0, &arg_join_controllers },<br>
+ { "Manager", "DefaultOOMScore", config_parse_string, 0, &arg_default_oom_score },<br>
{ "Manager", "RuntimeWatchdogSec", config_parse_sec, 0, &arg_runtime_watchdog },<br>
{ "Manager", "ShutdownWatchdogSec", config_parse_sec, 0, &arg_shutdown_watchdog },<br>
{ "Manager", "CapabilityBoundingSet", config_parse_bounding_set, 0, &arg_capability_bounding_set_drop },<br>
@@ -1414,6 +1416,12 @@ int main(int argc, char *argv[]) {<br>
if (parse_config_file() < 0)<br>
goto finish;<br>
<br>
+ if (arg_default_oom_score)<br>
+ if (write_string_file("/proc/self/oom_score_adj", arg_default_oom_score) < 0){<br>
+ log_error("Fail to set default oom_score_adj: %s", arg_default_oom_score);<br>
+ goto finish;<br>
+ }<br>
+<br>
if (arg_running_as == SYSTEMD_SYSTEM)<br>
if (parse_proc_cmdline() < 0)<br>
goto finish;<br>
diff --git a/src/core/system.conf b/src/core/system.conf<br>
index 508e0f5..7c0e12e 100644<br>
--- a/src/core/system.conf<br>
+++ b/src/core/system.conf<br>
@@ -41,3 +41,4 @@<br>
#DefaultLimitNICE=<br>
#DefaultLimitRTPRIO=<br>
#DefaultLimitRTTIME=<br>
+#DefaultOOMScore=<br>
diff --git a/src/core/user.conf b/src/core/user.conf<br>
index 4252451..f101e99 100644<br>
--- a/src/core/user.conf<br>
+++ b/src/core/user.conf<br>
@@ -15,3 +15,4 @@<br>
#DefaultControllers=cpu<br>
#DefaultStandardOutput=inherit<br>
#DefaultStandardError=inherit<br>
+#DefaultOOMScore=<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.10.4<br>
<br>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org">systemd-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/systemd-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</font></span></blockquote></div><br></div>