提交 50b37ca8 编写于 作者: L LiFeng

lcr: fix invalid memory swappiness

Signed-off-by: NLiFeng <lifeng68@huawei.com>
上级 b8cc45a5
...@@ -1279,7 +1279,7 @@ static int trans_resources_mem_swap(const oci_runtime_config_linux_resources *re ...@@ -1279,7 +1279,7 @@ static int trans_resources_mem_swap(const oci_runtime_config_linux_resources *re
} }
} }
if (res->memory->swappiness != INVALID_INT) { if (res->memory->swappiness != -1) {
/* set swappiness parameter of vmscan */ /* set swappiness parameter of vmscan */
nret = trans_conf_uint64(conf, "lxc.cgroup.memory.swappiness", res->memory->swappiness); nret = trans_conf_uint64(conf, "lxc.cgroup.memory.swappiness", res->memory->swappiness);
if (nret < 0) { if (nret < 0) {
......
/* /*
Copyright 2017 Giuseppe Scrivano Copyright 2017 Giuseppe Scrivano
Copyright (C) Huawei Technologies., Ltd. 2018-2019. All rights reserved. Copyright (C) Huawei Technologies., Ltd. 2018-2019. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
......
/* /*
Copyright 2017 Giuseppe Scrivano Copyright 2017 Giuseppe Scrivano
Copyright (C) Huawei Technologies., Ltd. 2018-2019. All rights reserved. Copyright (C) Huawei Technologies., Ltd. 2018-2019. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
......
...@@ -285,7 +285,7 @@ static bool update_resources_mem(struct lxc_container *c, struct lcr_cgroup_reso ...@@ -285,7 +285,7 @@ static bool update_resources_mem(struct lxc_container *c, struct lcr_cgroup_reso
{ {
bool ret = false; bool ret = false;
// If the memory update is set to -1 we should also set swap to -1, it means unlimited memory. // If the memory update is set to -1 we should also set swap to -1, it means unlimited memory.
if (cr->memory_limit == -1) { if (cr->memory_limit == -1) {
cr->memory_swap = -1; cr->memory_swap = -1;
} }
......
...@@ -65,10 +65,10 @@ void engine_free_log_prefix(void) ...@@ -65,10 +65,10 @@ void engine_free_log_prefix(void)
static ssize_t write_nointr(int fd, const void *buf, size_t count); static ssize_t write_nointr(int fd, const void *buf, size_t count);
static void do_fifo_log(const struct engine_log_object_metadata *metadata, const char *timestamp, static void do_fifo_log(const struct engine_log_object_metadata *metadata, const char *timestamp,
const char *msg); const char *msg);
static void do_stderr_log(const struct engine_log_object_metadata *metadata, const char *timestamp, static void do_stderr_log(const struct engine_log_object_metadata *metadata, const char *timestamp,
const char *msg); const char *msg);
/* engine change str logdriver to enum */ /* engine change str logdriver to enum */
static int engine_change_str_logdriver_to_enum(const char *driver) static int engine_change_str_logdriver_to_enum(const char *driver)
...@@ -212,7 +212,7 @@ out: ...@@ -212,7 +212,7 @@ out:
} }
static int do_log_by_driver(const struct engine_log_object_metadata *metadata, const char *msg, static int do_log_by_driver(const struct engine_log_object_metadata *metadata, const char *msg,
const char *date_time) const char *date_time)
{ {
switch (g_engine_log_driver) { switch (g_engine_log_driver) {
case LOG_DRIVER_STDOUT: case LOG_DRIVER_STDOUT:
...@@ -314,7 +314,7 @@ static void do_write_log_into_file(int log_fd, char *log_msg, size_t max_len, si ...@@ -314,7 +314,7 @@ static void do_write_log_into_file(int log_fd, char *log_msg, size_t max_len, si
/* log append logfile */ /* log append logfile */
static void do_fifo_log(const struct engine_log_object_metadata *metadata, const char *timestamp, static void do_fifo_log(const struct engine_log_object_metadata *metadata, const char *timestamp,
const char *msg) const char *msg)
{ {
char log_buffer[ENGINE_LOG_BUFFER_SIZE] = { 0 }; char log_buffer[ENGINE_LOG_BUFFER_SIZE] = { 0 };
int log_fd = -1; int log_fd = -1;
...@@ -353,7 +353,7 @@ static void do_fifo_log(const struct engine_log_object_metadata *metadata, const ...@@ -353,7 +353,7 @@ static void do_fifo_log(const struct engine_log_object_metadata *metadata, const
/* log append stderr */ /* log append stderr */
static void do_stderr_log(const struct engine_log_object_metadata *metadata, const char *timestamp, static void do_stderr_log(const struct engine_log_object_metadata *metadata, const char *timestamp,
const char *msg) const char *msg)
{ {
char *tmp_prefix = NULL; char *tmp_prefix = NULL;
if (metadata->level > g_engine_log_level) { if (metadata->level > g_engine_log_level) {
......
文件模式从 100644 更改为 100755
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册