conf: Add lmk_governor_post_wss_enabled to turn on/off governor post with WSS 80/298380/2
authorUnsung Lee <unsung.lee@samsung.com>
Tue, 5 Sep 2023 02:47:24 +0000 (11:47 +0900)
committerUnsung Lee <unsung.lee@samsung.com>
Wed, 6 Sep 2023 08:44:13 +0000 (17:44 +0900)
Add lmk_governor_post_wss_enabled variable to turn on/off governor post with
working set size (WSS).

Change-Id: I31f24e0dde2514893338429fc65ed83e75a3697e
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
src/common/conf/memory-common.c [new file with mode: 0644]
src/common/conf/memory-common.h [new file with mode: 0644]
src/resource-limiter/memory/lowmem.c

diff --git a/src/common/conf/memory-common.c b/src/common/conf/memory-common.c
new file mode 100644 (file)
index 0000000..657ae4b
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * resourced
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdbool.h>
+#include "memory-common.h"
+
+static bool lmk_governor_post_wss_enabled = false;
+
+void lmk_governor_post_enable_wss(void)
+{
+       lmk_governor_post_wss_enabled = true;
+}
+
+bool lmk_governor_post_is_enabled_of_wss(void)
+{
+       return lmk_governor_post_wss_enabled;
+}
diff --git a/src/common/conf/memory-common.h b/src/common/conf/memory-common.h
new file mode 100644 (file)
index 0000000..866c2d3
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * resourced
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __MEMORY_COMMON_H__
+#define __MEMORY_COMMON_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+void lmk_governor_post_enable_wss(void);
+bool lmk_governor_post_is_enabled_of_wss(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __MEMORY_COMMON_H__ */
index c520f57..587221d 100644 (file)
@@ -70,6 +70,7 @@
 #include "resourced-helper-worker.h"
 #include "dedup-common.h"
 #include "const.h"
+#include "memory-common.h"
 
 #define MAX_PROACTIVE_HIGH_VICTIMS          4
 #define FOREGROUND_VICTIMS                  1
@@ -779,11 +780,13 @@ static int lowmem_kill_victims(int max_victims,
                goto leave;
        }
 
-       ret = syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_wss(
+       if (lmk_governor_post_is_enabled_of_wss()) {
+               ret = syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_wss(
                                lowmem_kill_candidates);
-       if (ret < 0) {
-               status = LOWMEM_RECLAIM_NEXT_TYPE;
-               goto leave;
+               if (ret < 0) {
+                       status = LOWMEM_RECLAIM_NEXT_TYPE;
+                       goto leave;
+               }
        }
 
        ret = syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_foreground(