platform/core/system/resourced.git
8 months agocpu-boosting: Modify cpu boosting level to handle cpu contention 38/297138/7
Unsung Lee [Thu, 10 Aug 2023 23:55:39 +0000 (08:55 +0900)]
cpu-boosting: Modify cpu boosting level to handle cpu contention

Modify cpu boosting level to handle cpu contention.
The cpu boosting governor makes a list of commands to handle cpu contention,
and it decreases cpu boosting level of some threads (victims).

The cpu boosting module waits for timer events to check whehter cpu contention
is alleviated or not. If so, restoring cpu boosting level.
If not, making a new timer to check cpu contention after some interval.

Currently, cpu boosting module just checks whether PSI events are not
triggered for some interval. It is not the best solution, but simple
and intuitive solution.

Change-Id: I897c89c054ab11ed08ad16ef171610d7fa2944bd
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
8 months agocpu-boosting: Execute cpu boosting backend (governor) 27/297127/5
Unsung Lee [Thu, 10 Aug 2023 03:09:00 +0000 (12:09 +0900)]
cpu-boosting: Execute cpu boosting backend (governor)

Execute cpu boosting governor in plugin backend to govern cpu contention.
The prototype of governor function is like below:
  - int syscommon_plugin_resourced_cpu_boosting_governor_govern_request
(GHashTable *cpu_boosting_info_table,
 cpu_boosting_level_e cpu_boosting_level,
 GSList **cpu_boosting_controller_action);
    * This function receives cpu_boosting_info_table and cpu_boosting_level
      as inputs and gives cpu_boosting_controller_action as an output.
      If return value of this function is not 0,
      then cpu_boosting_controller_action is meaningless.

Change-Id: I6c8d805b63e258147932fb7ce8928001ef715ca8
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
8 months agocpu-boosting: Move cpu boosting common struct to libsyscommon 26/297126/5
Unsung Lee [Wed, 9 Aug 2023 12:52:19 +0000 (21:52 +0900)]
cpu-boosting: Move cpu boosting common struct to libsyscommon

Extract cpu boosting common struct and move it to libsyscmmon to be referenced
between resourced cpu boosting module and cpu boosting plugin backend.

structure name is changed like below for consistency:
  - cpu_boosting_info -> syscommon_resourced_cpu_boosting_info
  - cpu_boosting_input -> syscommon_resourced_cpu_boosting_input

Change-Id: Id1296115c984cd03250cbb3cf182b79f4067ecaf
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
8 months agocpu-boosting-monitor: Notify cpu boosting module when monitoring cpu PSIs 25/297125/5
Unsung Lee [Wed, 9 Aug 2023 07:27:06 +0000 (16:27 +0900)]
cpu-boosting-monitor: Notify cpu boosting module when monitoring cpu PSIs

Notify cpu boosting module when cpu PSIs are triggered.
When monitoring cpu PSIs, the monitor needs to wake up cpu boosting main thread.
This is because cpu boosting monitor just catches cpu PSIs and need to
wait for next PSI events.

Thread running cpu boosting monitor should wake up main cpu boosting thread
running g_main_loop_run() function. When main cpu boosting is idle,
the thread is woken up immediately.

Change-Id: I7f89265f4e7394c07c86cb0f3e40edc785eb922c
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
8 months agocpu-boosting: Init cpu boosting module early 24/297124/5
Unsung Lee [Wed, 9 Aug 2023 04:42:10 +0000 (13:42 +0900)]
cpu-boosting: Init cpu boosting module early

Initialize cpu boosting module earlier than cpu boosting monitor module.
This is because, cpu boosting module must be ready to accept requests from
cpu boosting monitor.
Currently, cpu boosting module does not depend on any other resourced modules,
so initailize cpu boosting module with the highest priority (i.e., MODULE_PRIORITY_EARLY).

Change-Id: I9cff9d0c24205d7887b4d6d758b7410efe1fc165
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
8 months agocpu-boosting-monitor: Add cpu PSI monitor module 23/297123/5
Unsung Lee [Wed, 9 Aug 2023 03:23:25 +0000 (12:23 +0900)]
cpu-boosting-monitor: Add cpu PSI monitor module

Add cpu PSI monitor to detect cpu contention.
cpu PSI monitor code works very similar with lowmem PSI monitor (memory PSI).
However, CPU PSI is only focusing on 'some' events.
This is because, global CPU PSI information (i.e., /proc/pressure/cpu)
always has zero (i.e., meaningless value) for 'full'.

Change-Id: Ie4d06bda0a57d7918abc1dddd23eb09dfffce053
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
8 months agocpu-boosting: Split a cpu boosting info table into three tables 22/297122/4
Unsung Lee [Thu, 10 Aug 2023 07:44:13 +0000 (16:44 +0900)]
cpu-boosting: Split a cpu boosting info table into three tables

Split a cpu boosting info table into three independent cpu boosting info tables
according to cpu boosting level.
Currently, resourced supports three cpu boosting level
(CPU_BOOSTING_LEVEL_STRONG, CPU_BOOSTING_LEVEL_MEDIUM, and CPU_BOOSTING_LEVEL_WEAK).

Separate cpu boosting info table according to cpu boosting level
to find and handle threads with same cpu boosting level easily.

Change-Id: I9eb8eac89df8112e91802154401fd59bd0626781
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
8 months agolowmem-monitor: Check return value of eventfd_write and remove useless code 73/297673/3 accepted/tizen/unified/20230825.044230 accepted/tizen/unified/riscv/20230829.072052
Unsung Lee [Tue, 22 Aug 2023 11:47:50 +0000 (20:47 +0900)]
lowmem-monitor: Check return value of eventfd_write and remove useless code

Check return value of eventfd_write and remove eventfd_read function. This is
because if eventfd_write is not correctly working (return value is -1),
then monitor pthread will not be exited. In addition, eventfd_read is used to
read dummy value, so psi monitor will be exited correctly regardless of eventfd_read.

It solves problems reported by Coverity with cid = 1704480 and cid = 1704688.

Change-Id: Ic753aaf3b96c95d7f1e2e629c165800728b92289
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
8 months agolowmem-monitor: Add a module for PSI and vmpressure 08/297508/1 accepted/tizen/unified/20230822.162228
SangYoun Kwak [Mon, 21 Aug 2023 05:57:25 +0000 (14:57 +0900)]
lowmem-monitor: Add a module for PSI and vmpressure

A new module "lowmem-monitor" is added:
 - Initialize monitor: PSI or vmpressure
    - Use PSI if the PSI initialization was successful.
    - Use vmpressure otherwise.

Change-Id: I37d9b223698d3742dd4a02b27c94f65852810fb4
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
9 months agolowmem-monitor: Modify PSI monitor to do one action per monitor 11/296711/1 accepted/tizen/unified/20230809.071852 accepted/tizen/unified/riscv/20230809.013259
SangYoun Kwak [Thu, 3 Aug 2023 08:24:44 +0000 (17:24 +0900)]
lowmem-monitor: Modify PSI monitor to do one action per monitor

Multiple events can be occured at one epoll_wait return.
In this case, lowmem_trigger_memory_state_action can be called multiple
times which is unnecessary.
With this patch, lowmem_trigger_memory_state_action will be called only
once per epoll_wait's return.

Change-Id: I6ef5cc7aeee4c9baa273517333c1cd2655752d58
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
9 months agolowmem-monitor: Modify PSI's epoll_wait as blocking 04/296704/1
SangYoun Kwak [Thu, 3 Aug 2023 07:56:49 +0000 (16:56 +0900)]
lowmem-monitor: Modify PSI's epoll_wait as blocking

Previously, epoll_wait was non-blocking and the timeout was 0.
It means that epoll_wait will return immediately after checking events.
With this method, the psi monitor thread will consume cpu(it will check
events intensively) so sleep(3) was used to prevent the consuming
situation.
But it makes psi monitor thread to sleep, which might miss events within
the sleeping period.

By making epoll_wait blocking, this problem will be solved.

Change-Id: I4f2b1ff06b53bcca2830d4c2ecb972fc17904f52
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
9 months agolowmem-monitor: Modify PSI memory monitoring levels 98/296698/1
SangYoun Kwak [Thu, 3 Aug 2023 07:03:38 +0000 (16:03 +0900)]
lowmem-monitor: Modify PSI memory monitoring levels

The levels of PSI memory monitor changed from 5 levels to 3 levels.
 1. PSI_MEM_LEVEL_LOW (low psi, memory stall is small)
 2. PSI_MEM_LEVEL_MEDIUM
 3. PSI_MEM_LEVEL_HIGH (high psi, memory stall is greater than the aboves)
In accordance with the modification above, stall time also changed.

Code modifications are made to accompany the above modification.

Change-Id: I2bc87ae48a6dd7fc2d019e4a8ebece899c81c747
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
9 months agolowmem-monitor: Modify psi event handler like vmpressure 97/296697/1
SangYoun Kwak [Thu, 3 Aug 2023 06:33:58 +0000 (15:33 +0900)]
lowmem-monitor: Modify psi event handler like vmpressure

The handler for psi events is modified like the vmpressure's one.
 - Get available memory by calling proc_get_mem_available()
 - Get memory status(level) by calling lowmem_check_mem_state()
 - Do an action by calling lowmem_trigger_memory_state_action
 - Do nothing if the available memory is same as the previous one.

Change-Id: I770093c1ad501c63620444a6aede91f500978fd3
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
9 months agoproc: Check whether window is enabled or not 17/296617/3 accepted/tizen/unified/20230803.174805
Unsung Lee [Wed, 2 Aug 2023 07:48:51 +0000 (16:48 +0900)]
proc: Check whether window is enabled or not

Check the option which indicates whether window is enabled or not.
If the corresponding option is turned off, then do not execute
window related code in proc and lowmem modules.

If the option is turned on,
   - Update window stack each time
   - Active 'ForegroundAppList' config
   - Consider window information during LMK

Change-Id: Id976634628ca9bdd49e8e508ebc70739c410f7e3
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agoproc: Reset the window stack information from proc_app_info 63/296563/5
Unsung Lee [Mon, 31 Jul 2023 11:17:47 +0000 (20:17 +0900)]
proc: Reset the window stack information from proc_app_info

Reset window stack information before updating it
to remove invalid window information.
Currently, window information of window stack is saved in proc_app_info,
so resourced needs to know each window owner after the latest window stack update.

Change-Id: If2ef136577c329e63cf48673254b9e04642b283c
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agoproc-monitor: Check window validity using focus information 62/296562/5
Unsung Lee [Mon, 31 Jul 2023 08:11:20 +0000 (17:11 +0900)]
proc-monitor: Check window validity using focus information

Check whether focus information of app life cycle
and focus information of window stack is same to judge window stack validity.

Window information in window stack includes focus information
and appfw also notifies resourced when focus information of app is updated.
In this case, both information should be synchronized.

Change-Id: I7a9a0e5eb772ac93ec45d07bb393d8d42e832f41
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agoproc-monitor: Update window stack when updating app life cycle 61/296561/2
Unsung Lee [Mon, 31 Jul 2023 07:27:36 +0000 (16:27 +0900)]
proc-monitor: Update window stack when updating app life cycle

Update window stack information when app life cycle is updated
to get the latest window stack information.

Window stack is dbus method call, so resourced doest not know
when window stack is updated. On the other hand, app life cycle update
can be caught by call back function. That is, resourced can catch
timing of window stack update using app life cycle

Change-Id: I626d338e7e45814449a899f2ed9ebf059e9a964a
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agoproc-monitor: Identify windows to save in app info 60/296560/1
Unsung Lee [Mon, 31 Jul 2023 06:04:58 +0000 (15:04 +0900)]
proc-monitor: Identify windows to save in app info

A process can have more than one window, so identify
a window to save in an app info.
Currently, if a process already registered a window
and other window of this process is not focused,
then resourced ignores window update.

Change-Id: I50890744ee93dd8da4fd996a3eea7880a7efd9ee
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agolowmem: Pass oom level to LMK governor post for fg app 35/296335/7
Unsung Lee [Tue, 25 Jul 2023 11:38:12 +0000 (20:38 +0900)]
lowmem: Pass oom level to LMK governor post for fg app

LMK governor post function reordering foreground status app candidates
requires oom level, so pass oom level to this post function.

LMK governor post function reordering foreground status app candidates
needs to know oom level to judge whether all candidates are
from foreground app or not.

Change-Id: I3fad91585db910a39dc5e9ccdc52b22e5401f66d
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agomemory-cgroup: Move code to correct module and refer to correct module 34/296334/7
Unsung Lee [Tue, 25 Jul 2023 10:26:09 +0000 (19:26 +0900)]
memory-cgroup: Move code to correct module and refer to correct module

Move lowmem module code which is located in memory-cgroup to lowmem module.
In addition, add a function which sets lowest oom score of memory cgroup.
Previously, swap module was incorrectly referencing oom level
insteaf of memory cgroup.

Relocation is done like below:
  - oom_level is only related to lowmem module. so move all related functions
    to lowmem module
  - swap module needs to reference memory cgroup to move pid
    to Throttling memory cgroup. Therefore, it should reference function
    from memory cgroup instead of lowmem module.

Change-Id: Idd863113f7d058afa60973aea541d5c1c03a2c02
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agolowmem: Move oom level to libsyscommon 09/296509/4
Unsung Lee [Sun, 30 Jul 2023 06:58:47 +0000 (15:58 +0900)]
lowmem: Move oom level to libsyscommon

enum oom_level needs to be referenced by both resourced lowmem module and
resourced plugin-backend (i.e., LMK governor). Therefore, it should be located
a shared library (i.e., libsyscommon) which can be accessed by both sides.
In addition, add corresponding header file from libsyscommon.

Change-Id: I1f6c9676e1cdf9f436cbaa5413ed433dfe6e4ffe
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agolowmem: Support 'get_kill_candidates_post' funcs 59/294659/19
Unsung Lee [Wed, 21 Jun 2023 10:31:02 +0000 (19:31 +0900)]
lowmem: Support 'get_kill_candidates_post' funcs

Support LMK governor post funcs which will be called after
LMK governor function to reorder a victim candidate list

resourced LMK needs to reorder victim candidates list according to
serveral conditions (e.g., working set size, foreground app status)

resourced supports three type of get_kill_candidates_post ops newly
  - int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post(
  GArray *candidates)
  to consider user custom governor policy
  - int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_wss(
  GArray *candidates)
  to consider working set size of app
  - int syscommon_plugin_resourced_memory_lmk_get_kill_candidates_post_with_foreground(
  GArray *candidates)
  to consider window information of app

Change-Id: I32bab160d66d05cd986b9f84c942ea1d2b8a59c4
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agomemory-cgroup: Add a new oom_level called OOM_LEVEL_FOREGROUND 04/296304/7
Unsung Lee [Fri, 21 Jul 2023 08:01:52 +0000 (17:01 +0900)]
memory-cgroup: Add a new oom_level called OOM_LEVEL_FOREGROUND

Add a new oom_level called OOM_LEVEL_FOREGROUND
between OOM_LEVEL_MOST_RECENTLY_USED and OOM_LEVEL_FOREGROUND_AND_PROC
to choose victims only from foreground status app group.
Although all foreground apps are contained in
OOM_LEVEL_FOREGROUND_AND_PROC group, it also contains process in /proc.

Change-Id: Ie257c8a280afe89eaa750075aa09a7f8d6167396
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agolowmem: Initalize task window info using app window info 48/295748/10
Unsung Lee [Thu, 13 Jul 2023 01:38:52 +0000 (10:38 +0900)]
lowmem: Initalize task window info using app window info

When LMK is triggered by low memory, task window information is
needed to be initalize using app window information

LMK governor needs to know window information to make an order of
vicitim candidates. Currently, resourced app information includes
itself window information. Therefore, app window information needs
to be passed to task info.

Change-Id: If54217a1a4738d3a01945e8c375d6c3d2144895e
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agolowmem: Set fixed oom_score_adj of foreground app during LMK 93/294693/17
Unsung Lee [Fri, 23 Jun 2023 04:19:17 +0000 (13:19 +0900)]
lowmem: Set fixed oom_score_adj of foreground app during LMK

Set fixed oom_score_adj during LMK process when app is foreground
and foreground oom_score_adj is fixed.

resourced LMK considers oom_score_adj and memory size to choose vicitim when
available memory size is too low. Meanwhile, some apps should not be killed
by LMK when apps are foreground (visible to user).
This configuration can protect foreground apps when LMK is triggered by
fixing low oom_score_adj.

If foreground oom_score_adj is already fixed by the configuration and
App is foreground, then oom_score_adj of 'task_info' gets value from
the fixed oom_score_adj (very low value).

Change-Id: Idbc1352a1994f7bc5363159021117b8b0e79f2a4
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agoproc-oom-priority: Set low oom_score_adj for 'ForegroundAppList' 47/295747/10
Unsung Lee [Wed, 12 Jul 2023 05:57:04 +0000 (14:57 +0900)]
proc-oom-priority: Set low oom_score_adj for 'ForegroundAppList'

Set low oom_score_adj of foreground app if the corresponding configuration sets.

oom_score_adj is an important indicator to choose victim
when available memory is too low.
Therefore, if specific foreground app(s) have low fixed oom_score_adj
compared to other apps, then they will be selected for victim with relatively
low probability.

Change-Id: Ic2752fb658da05d9d92a167e5a0f4d1dae411994
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agoconf: Parse 'ForegroundAppList' property of process.conf 58/294658/18
Unsung Lee [Thu, 22 Jun 2023 09:06:17 +0000 (18:06 +0900)]
conf: Parse 'ForegroundAppList' property of process.conf

Parse configuration for foreground status app(s)
which want to have low oom_socre_adj

This configuration supports recording low oom_score_adj
for foreground app. oom_score_adj is an important indicator
to choose victim when available memory is too low.
Therefore, with this configuration, specific foreground app(s) have low
probability to be choosen as victim of LMK.

A new configuration called 'App' in section 'ForegroundAppList'
is added in process.conf

Change-Id: Ia25c4a966ad7351e0bf67b55d8fb925417f1cc8c
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agoconf: Extract functions to reduce duplicate code 46/295746/7
Unsung Lee [Wed, 12 Jul 2023 00:34:38 +0000 (09:34 +0900)]
conf: Extract functions to reduce duplicate code

Find configuration parsing codes that are predicted to be commonly used and
extract them as functions.

'proc_conf_info' structure is used to store configurations of
per process information. In addition, this structure can be used
for all kind of configurations in resourced
(e.g., limiter.conf, optimizer.conf, and process.conf).
Therefore, initialization and inserting of 'proc_conf_info'
are predicted to be commonly used.

Change-Id: I161ffce5c6b28ee4acf9610af7c984f2323ea07e
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agoproc-monitor: Save window info obtained from window system in app info 52/294552/39
Unsung Lee [Mon, 19 Jun 2023 08:49:25 +0000 (17:49 +0900)]
proc-monitor: Save window info obtained from window system in app info

Send dbus method call to window system to get window stack
and store window information into app information after checking validity

The window system manages information of windows called window stack, and
window stack includes information such as visibility and whether a window has
focus. This information is added to app information after validation process.

New dbus method call added from resourced to window system.
  - A bus name (org.enlightenment.wm), a path (/org/enlightenment/wm),
  and an interface (org.enlightenment.wm.proc) of window system
  - A method (GetVisibleWinInfo_v2)

Change-Id: I03984bbfedc7f861063c824ecd7541cc0bc8794f
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agoRefactor enum 'oom_score' for high readability 84/296084/7
Unsung Lee [Wed, 19 Jul 2023 06:09:28 +0000 (15:09 +0900)]
Refactor enum 'oom_score' for high readability

Rename 'oom_score' enumeration and refactor all of code related to
this enumeration to improve readability

resourced uses enum 'oom_score' and this enum has four elements
(OOM_SCORE_HIGH, OOM_SCORE_MEDIUM, OOM_SCORE_LOW, OOM_SCORE_MAX).
Each element means foreground app + /proc group,
most recently used background app group,
least recently used background app group, and all process group respectively.
However, it is too difficult to match element and group.
In addition, order of the element is wrong.

Name 'oom_score' is changed to 'oom_level' and
each element name is changed like below:
OOM_SCORE_LOW  -> OOM_LEVEL_BACKGROUND_LEAST_RECENTLY_USED = 0
OOM_SCORE_MEDIUM -> OOM_LEVEL_BACKGROUND_MOST_RECENTLY_USED = 1
OOM_SCORE_HIGH  -> OOM_LEVEL_FOREGROUND_AND_PROC = 2
OOM_SCORE_MAX  -> OOM_LEVEL_ALL = 3

Change-Id: I499f1ef23a83d0e436f91b8de5437fece7c916ac
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
9 months agolowmem-monitor: Disable PSI monitoring method 14/296414/1
SangYoun Kwak [Thu, 27 Jul 2023 06:31:23 +0000 (15:31 +0900)]
lowmem-monitor: Disable PSI monitoring method

The PSI monitoring feature of lowmem-monitor was disabled since this
feature is under development.

Change-Id: I0459020a64ace157b0d421a6fd1fb797b0fed263
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
10 months agolowmem-monitor: Add PSI monitoring method 54/295654/5
SangYoun Kwak [Wed, 12 Jul 2023 07:12:27 +0000 (16:12 +0900)]
lowmem-monitor: Add PSI monitoring method

PSI, the "Pressure Stall Information" functionality of the kernel
monitors the stall time of CPU, IO and Memory.
Since it monitors memory stall, it can be used as a monitoring method of
the LMK.

As a new monitoring method, PSI monitoring has been added to the LMK.
(To use this method, the kernel should support PSI)

Change-Id: Ic19fb8a74b4047788b8ce52f18a1f04d028ef136
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
10 months agolowmem-monitor: Rename to lowmem-monitor-vmpressure 53/295653/3
SangYoun Kwak [Tue, 11 Jul 2023 10:54:58 +0000 (19:54 +0900)]
lowmem-monitor: Rename to lowmem-monitor-vmpressure

Since the current LMK monitoring method uses vmpressure(cgroup), clarify
it by adding 'vmpressure' to the file name and symbols.

Change-Id: I435c1acebe03d828da36a79980136ae5531c2f11
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
10 months agoconf: Add detailed explanations for process confs 64/295564/3
SangYoun Kwak [Tue, 11 Jul 2023 02:42:39 +0000 (11:42 +0900)]
conf: Add detailed explanations for process confs

Sections below needed to be explained more in detail:
 * In the 7.1 section:
    - ActionOnFailure (What it does)
    - OomScore (What are the predefined oom_score_adj values)
 * In the 8.1 section:
    - ACTION_ON_FAILURE (What it does)

Change-Id: I88a892586accec682a6be883e8ef16d31e0acebf
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
10 months agoFix the build error using gcc 13 30/295230/1 accepted/tizen_unified_dev accepted/tizen/unified/20230706.152150 accepted/tizen/unified/dev/20230726.115715
SangYoun Kwak [Tue, 4 Jul 2023 04:43:08 +0000 (13:43 +0900)]
Fix the build error using gcc 13

In the function "resourced_proc_dump" from src/process/proc-main.c, it
concatenates directory and filename and writes it into a buffer using
snprintf.
In this situation, the gcc-13 compiler complains about: the length of
directory + filename can be greater than the size of the buffer, so
it should be handled.
It is already handled by checking the lengths of the directory &
filename but the compiler don't know about it.
To fix this situation, codes for checking the return value of snprintf
have been added.

Change-Id: I2776c5164c57323212e09377ca0eff1f55279ec6
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
11 months agooptimizer.conf: Change CPU RT throttling from 90% to 95% 75/293675/1 accepted/tizen/unified/20230613.170823
Unsung Lee [Tue, 28 Mar 2023 08:17:03 +0000 (17:17 +0900)]
optimizer.conf: Change CPU RT throttling from 90% to 95%

This patch includes
  - modification of CPU RT runtime

Increase the value from 90% to 95% to avoid throttling issue.

Change-Id: Ie80f32191a428b03e86606eb851ec5e9fb5ac836
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
12 months agoRename package, include and function name of system plugin 91/292091/3
SangYoun Kwak [Thu, 27 Apr 2023 05:48:45 +0000 (14:48 +0900)]
Rename package, include and function name of system plugin

Since the name of plugin has changed to syscommon-plugin/system-plugin,
the package name, include path and function name of plugin should be
changed.
 * in .spec file and CMakeLists.txt, package names are renamed:
      plugin-api-resourced -> libsyscommon-plugin-api-resourced
 * include path:
      plugin/plugin-resourced... -> syscommon-plugin-resourced...
      (The 'system' directory was included by the package config(.pc)
       file of plugins)
 * function name:
      plugin_resourced_memory_lmk_get_kill_candidates
      -> syscommon_plugin_resourced_memory_lmk_get_kill_candidates

Change-Id: Ie3b07e06e4d43536ac5ba2d92a2ef7ed2c1926b7
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
12 months agoRename plugins according to conf/resource/module 65/291665/1
Unsung Lee [Wed, 19 Apr 2023 04:53:27 +0000 (13:53 +0900)]
Rename plugins according to conf/resource/module

Renaming plugins in resourced-*.rpm package considering conf, resource, and module.
Plugin library name normally follows the rule below:
libplugin-resourced-<conf>-<resource>-<module>.so

conf: 'limiter' or 'optimizer' or 'monitor' or ''
resource: 'cpu' or 'memory' or ''

Change-Id: I14512fc0bb5f4a36a2a64a0b7f6c9da9e4e0bf46
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
13 months agoresourced.spec: revert "Undo modification of light package" 90/291590/2
Unsung Lee [Wed, 19 Apr 2023 01:43:24 +0000 (10:43 +0900)]
resourced.spec: revert "Undo modification of light package"

This reverts commit 6a493507d964637b89b5b6d69208189609de5e33.
This is because light package requires bin package, so even if the light package
is empty, there is no problem at all.

Change-Id: I133ec3bf45919d8e3d955ca17a6508a149e9a594
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
13 months agolowmem: Add MEM_LEVEL_LOW in lowmem_register_mem_level_controller() 31/291331/2
Unsung Lee [Thu, 13 Apr 2023 11:27:06 +0000 (20:27 +0900)]
lowmem: Add MEM_LEVEL_LOW in lowmem_register_mem_level_controller()

MEM_LEVEL_LOW is missing in lowmem_register_mem_level_controller(),
so currently controller of MEM_LEVEL_LOW is always NULL.
It causes SIGABRT when memory level is MEM_LEVEL_LOW.
To fix the problem, add MEM_LEVEL_LOW in lowmem_register_mem_level_controller()

Change-Id: I2bec09b0944f9f0b33c8fa5487b7204a6fc1a305
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
13 months agolowmem: Remove unused function 19/291119/4
SangYoun Kwak [Mon, 10 Apr 2023 06:18:04 +0000 (15:18 +0900)]
lowmem: Remove unused function

A function named 'is_dynamic_process_killer' is a static inline function
but it is not used anywhere.

Change-Id: I3a75011f3d49461b29c731fe326a2cac06b4878a
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agolowmem: Rename structure and functions of controller ops 18/291118/4
SangYoun Kwak [Mon, 10 Apr 2023 05:21:28 +0000 (14:21 +0900)]
lowmem: Rename structure and functions of controller ops

For unity, structure for storing governor/controller and related
functions to it were renamed.

Big rules:
 * initialize -> register
 * controller_ops -> mem_level_ops
 * action -> controller

Details are below:
 * Registering(init) functions
    * lowmem_initialize_... -> lowmem_register_...
    * lowmem_..._governor_ops -> lowmem_..._lmk_governor
    * lowmem_..._kill_candidates -> lowmem_..._lmk_controller
    * lowmem_..._controller_ops_... -> lowmem_..._mem_level_...
    * lowmem_..._action -> lowmem_..._controller
 * Structure
    * struct lowmem_controller_ops -> structure lowmem_mem_level_ops
    * action -> controller
      (member of lowmem_mem_level_ops)
    * lowmem_actions[MEM_LEVEL_MAX] -> mem_level_ops_list[MEM_LEVEL_MAX]
      (declaration of 'struct lowmem_mem_level_ops')
 * Governor function
    * oom_mem_governor -> mem_state_oom_governor
      (for unity, since dummy governor is mem_state_dummy_governor)

Change-Id: Ieb03b2ced71dd4826fbedc75cc333215b8d20193
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agolowmem-controller: Move oom memory action from lowmem to controller 60/290660/17
SangYoun Kwak [Thu, 30 Mar 2023 08:21:27 +0000 (17:21 +0900)]
lowmem-controller: Move oom memory action from lowmem to controller

For modulization, oom memory action is moved from lowmem.c(core) to
lowmem-controller.c(controller) and this action will be assigned to
lowmem.c by the initializer of controller.

Change-Id: Ida6f53bb0af6a4d8ddf438ea14c939c732027bfb
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agolowmem-controller: Move critical memory action from lowmem to controller 81/290581/18
SangYoun Kwak [Wed, 29 Mar 2023 06:48:42 +0000 (15:48 +0900)]
lowmem-controller: Move critical memory action from lowmem to controller

For modulization, critical memory action is moved from lowmem.c(core) to
lowmem-controller.c(controller) and this action will be assigned to
lowmem.c by the initializer of controller.

Change-Id: Ied7e33d21dd2f6055ad45cbd576521fa595d68a8
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agolowmem-controller: Move low memory action from lowmem to controller 78/290578/18
SangYoun Kwak [Wed, 29 Mar 2023 06:25:01 +0000 (15:25 +0900)]
lowmem-controller: Move low memory action from lowmem to controller

For modulization, low memory action is moved from lowmem.c(core) to
lowmem-controller.c(controller) and this action will be assigned to
lowmem.c by the initializer of controller.

Functions which are related to swap_activate_act are moved to controller
as well.
register_notifier and unregister_notifier of
RESOURCED_NOTIFIER_MEM_CONTROL are moved to controller.

Change-Id: Icd0a0c78d660e773221426c585e41ee6c4449ed8
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agolowmem-controller: Move medium memory action from lowmem to controller 75/290575/18
SangYoun Kwak [Wed, 29 Mar 2023 04:47:42 +0000 (13:47 +0900)]
lowmem-controller: Move medium memory action from lowmem to controller

For modulization, medium memory action is moved from lowmem.c(core) to
lowmem-controller.c(controller) and this action will be assigned to
lowmem.c by the initializer of controller.

The dedup_act is moved from lowmem.c to controller since it is an action
of medium memory. But this function is also an action of critical
memory. Thus, a part of critical memory actions was replaced with
lowmem_controller_ops.

Change-Id: I04663b904cfd8c1a18008bc45be74abb2cb6fb47
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agolowmem-controller: Move high memory action from lowmem to controller 51/290351/18
SangYoun Kwak [Thu, 23 Mar 2023 10:38:01 +0000 (19:38 +0900)]
lowmem-controller: Move high memory action from lowmem to controller

For modulization, high memory action is moved from lowmem.c(core) to
lowmem-controller.c(controller) and this high memory action will be
assigned to lowmem.c by the initializer of controller.

Change-Id: Ic0f25890ff5372bfde5471bac27c441f19213960
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agolowmem-controller: Modify controller as a module 40/290340/14
SangYoun Kwak [Thu, 23 Mar 2023 08:56:13 +0000 (17:56 +0900)]
lowmem-controller: Modify controller as a module

lowmem-controller was just a library and used by lowmem.c.
lowmem-controller is now a module which is registered to module manager
of resourced and initialized as an independent module.

Change-Id: I207fa4404e076f2555cc00730e79e7c540c898dc
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agolowmem-monitor: Modify monitor as a module 61/290261/15
SangYoun Kwak [Wed, 22 Mar 2023 07:01:11 +0000 (16:01 +0900)]
lowmem-monitor: Modify monitor as a module

lowmem-monitor was just a library and initialized by lowmem.c using init
function.
lowmem-monitor is now a module which is registered to module manager of
resourced and initialized as an independent module.

lowmem-monitor calculates the memory state with the current available
memory and calls the lowmem_trigger_memory_state_action function with
memory state as a parameter.

lowmem_check_mem_state is a function that calculates memory state with
available memory. This function is used in oom action so it is located
in lowmem.c.

Change-Id: I9a29e7663a1f8a3ec7bf388f65c2cc97e87f5f48
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agolowmem-governor: Move governor to plugin-backend 38/288338/26
SangYoun Kwak [Wed, 15 Feb 2023 09:04:33 +0000 (18:04 +0900)]
lowmem-governor: Move governor to plugin-backend

lowmem-governor was moved from lowmem to plugin-backend-resourced.
lowmem module can use governor through the functions of
plugin-resourced.
 * "plugin_resourced_memory_lmk_get_kill_candidates" is a function of
   the plugin-backend-resourced. Kill candidates can be retrieved using
   this function.
 * plugin-api-resourced was added to the BuildRequires.

Change-Id: I3d010ee15cf74447ce4a354808bb662674670972
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agolowmem-governor: Modify governor as a module 13/290613/10
SangYoun Kwak [Wed, 29 Mar 2023 10:23:37 +0000 (19:23 +0900)]
lowmem-governor: Modify governor as a module

Since the lowmem-governor is separated from lowmem.c in functional
manner, it is better to modulize the lowmem-governor to reduce
dependency.

lowmem.c uses lowmem_governor_ops to use governor and
lowmem_governor_ops is initialized by the lowmem-governor.
lowmem-governor.h is removed since it is not used directly.

Change-Id: I177d847dd8010a9c66f970f2b7aec53f06210740
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agomodule: Add a new entry to the priority of modules 71/290871/5
SangYoun Kwak [Tue, 4 Apr 2023 09:27:43 +0000 (18:27 +0900)]
module: Add a new entry to the priority of modules

A new entry, MODULE_PRIORITY_INITIAL is added to the enum of
module_priority.

This priority is added for the reason below:
 * Since the 'lowmem' module has MODULE_PRIORITY_EARLY as its priority,
   modules separated from 'lowmem' module should be initialized before
   MODULE_PRIORITY_HIGH but after MODULE_PRIORITY_EARLY.

Thus, the newly added priority MODULE_PRIORITY_INITIAL will be used by
modules which need to be initialized before all other modules but after
MODULE_PRIORITY_EARLY.

Change-Id: I07f31f05c5b8851de14a8461504ce04784b6722f
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agomodule: Refactor to use lists per priorities 63/290863/5
SangYoun Kwak [Tue, 4 Apr 2023 08:04:32 +0000 (17:04 +0900)]
module: Refactor to use lists per priorities

The 'module' feature in resourced manages the modules.
Previously, it used one list to manage modules, so it has to check the
all modules in list to find which was looking for.

In this patch, the 'module' uses separate lists per priorities.
Since the lists of modules are classified by its priority, modules with
specific priority can be found without iterating all lists.

Entries of the 'enum module_priority' are added to make it easy to
iterate through the priorities. (These values are not a priority value)
 * MODULE_PRIORITY_MIN = -1
 * MODULE_PRIORITY_MAX

Change-Id: I7d620d03f1245ed589ea3753a474895f8b232468
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
13 months agoresourced.spec: Undo modification of light package 09/290709/5
Unsung Lee [Fri, 31 Mar 2023 02:44:45 +0000 (11:44 +0900)]
resourced.spec: Undo modification of light package

This patch includes
  - Making a symbolic link from resourced to resourced.common
  - Adding a symbolic link in the light/bin package

This patch undo part of commit 82b39f9c50adcf1d3dbd3bcb90db9eb1e2fe6427.

Change-Id: I9ce3134a1ecc4861cae616fbe823c6fec98f89b9
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
14 months agolowmem-governor: Refactor to use the governor independently 75/288375/11 accepted/tizen/unified/20230310.062650
SangYoun Kwak [Thu, 16 Feb 2023 02:38:34 +0000 (11:38 +0900)]
lowmem-governor: Refactor to use the governor independently

The governor was modified to use it independently.
 * The lists of apps/procs will be created by lowmem.c, and it will be
   passed to the governor(lowmem_governor_get_kill_candidates).
 * The governor will make an array(candidates) of "filtered and sorted".
   It consists of "struct task_info *".
 * The "struct task_info" was modified to store some informations from
   proc_app_info for governor. Also the pointer of oom_killed from
   proc_app_info was added for the killer.
 * According to the above change, killer of lowmem-controller.c was
   modified.
 * Codes that depend on resourced was removed from governor to lowmem.c.

Change-Id: I1350f2b511d13e3dc7cb1b2efb9e37bc62381275
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agoprocess: Support fixed oom for app via Private config 10/288410/3 accepted/tizen/unified/20230220.174507
Unsung Lee [Thu, 16 Feb 2023 06:39:01 +0000 (15:39 +0900)]
process: Support fixed oom for app via Private config

This patch includes
  - Parsing config from Private Section (config-parser.c/h)
  - Elimination of old style fixed oom config (proc.conf, README)
  - Replacement of oom_fixed_app_list using fixed_app_list
    (a.k.a. an hashtable which manages all apps in the Private Section)

Difference between old style fixed oom config and the current one
  - old style: Add app name directly in the common configuration file
  - the current style: Add app name in the Private Section (xxx.conf.d/yyy.conf)
    That is, any developer can add new configurations with making
private conf files.

Change-Id: I367f6b6e0a7315c1e84b1b3871f6bb7bcc4a005a
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
15 months agocpu-sched: Fix memory leak when loading the cpu affinity config 99/288399/2
Unsung Lee [Thu, 16 Feb 2023 06:15:18 +0000 (15:15 +0900)]
cpu-sched: Fix memory leak when loading the cpu affinity config

'name' value will not be freed when 'name' string is different from
'ForegroundApps' (return without free issue)

Change-Id: I5a2ef92944f16f518e40acb9d43285d9df3db1c6
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
15 months agocpu-sched: Optimize search for cpu affinity fixed app 82/288182/5
Unsung Lee [Mon, 13 Feb 2023 06:11:30 +0000 (15:11 +0900)]
cpu-sched: Optimize search for cpu affinity fixed app

This patch includes
  - Change serach for fixed cpu affnity apps
(using the hashtable of apps by calling
'fixed_app_and_service_exist_check(name, APP_TYPE) func')

resourced manages all per-app configurations
('Private' section) using a hashtable.
On the other hand, resourced (cpu-sched) managed cpu affinity fixed apps
using a list instead of hashtable.
That is, when resourced (cpu-sched) detects app launch or app status change,
it searches the list linearly to know whether the app requires fixed cpu affinity or not.
(Linear search is normally slow when app list size is big)

resourced (cpu-shced) will
  - use the hastable of the per-app configuration when searching an app
  - use the legacy list to apply something to all fixed cpu affinity apps

Change-Id: I9340e1e7c6796463625660780b82f30c7a91a025
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
15 months agocpu-sched: Support cpu affinity pinning for App 94/288094/10
Unsung Lee [Thu, 9 Feb 2023 02:32:19 +0000 (11:32 +0900)]
cpu-sched: Support cpu affinity pinning for App

This patch includes:
  - Parse configuration(s) of per app cpu affinity (config-parser.c/h)
  - Update of README to reflect per App cpu affinity (README)
  - Register cpu affinity fixed app in the list (cpu-sched.c)
  - Read /sys/devices/system/cpu/online to know onlie cpuset and
reflect the current online cpuset info to cpuset cgroup

Per app cpu affinity pinning is different from foreground cpu affinity
  - foreground cpu affinity: pinning cpu affinity for foreground status apps
    * foreground app status detect -> pinning cpu affinity
  - per App cpu affinity: pinning cpu affinity for fixed apps
  regardless of app status
* app launch detect -> pinning cpu affinity

Change-Id: Ibef926c5b40049ce00b97cf2ba74f83784efdccd
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
15 months agocpu-sched: Refactor common cpu affinity code 58/287858/8
Unsung Lee [Tue, 7 Feb 2023 07:00:18 +0000 (16:00 +0900)]
cpu-sched: Refactor common cpu affinity code

This patch includes
  - Refactoring of cpu-sched related code
    * 'cpu_sched_parse_cpuset' and 'cpu_shced_new_core' functions are moved
  from cpu-sched.c to config-parser.c/h
    * Cpu common data structure (i.e., 'coreset' and 'core') is moved
  from cpu-sched.c to cpu-common.h
    * Comments are modified
  - Renaming variable
    * Data structure: 'core' -> 'cpu_info' and 'coreset' -> 'cpuset_info'
    * Element: 'id' -> 'cpu_id' and 'on' -> 'online'
    * Other: minor change (such as local variable)

Change-Id: I1d04ee9c33b93f5f82504815c4344c2d472e25b8
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
15 months agolowmem-controller: Split up lowmem-controller feature from lowmem module 13/287613/8 accepted/tizen/unified/20230207.165818
SangYoun Kwak [Wed, 1 Feb 2023 09:10:41 +0000 (18:10 +0900)]
lowmem-controller: Split up lowmem-controller feature from lowmem module

The lowmem-controller.c was created by extracting the killing-process
feature from lowmem.c.
    * Newly created: lowmem-controller.c, lowmem-controller.h
    * "lowmem_controller_kill_candidates" function of
      lowmem-controller.c kills procs/apps from candidates list provided
      by the core(lowmem.c).
    * Symbols used only in lowmem-controller.c were moved from lowmem.c
      to lowmem-controller.c.
    * Symbols used both lowmem.c and lowmem-controller.c were moved from
      lowmem.c to lowmem.h.

Change-Id: I8bd0f65acc9df771385c1839096f1283424ce2a5
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agolowmem-monitor: Split up lowmem-monitor feature from lowmem module 93/287593/8
SangYoun Kwak [Wed, 1 Feb 2023 05:27:53 +0000 (14:27 +0900)]
lowmem-monitor: Split up lowmem-monitor feature from lowmem module

The lowmem-monitor.c was created by extracting the monitor feature from
lowmem.c. (The handler of lowmem pressure)
    * Newly created: lowmem-monitor.c, lowmem-monitor.h
    * "lowmem_monitor_pressure_initialize" function of
      lowmem-monitor.c initializes the handler for lowmem pressure.
    * Symbols used only in lowmem-monitor.c were moved from lowmem.c to
      lowmem-monitor.c.
    * The functions used in both lowmem-monitor.c and lowmem.c remain in
      lowmem.c and were changed to 'non-static' functions.

Change-Id: I26bad0c629b74e8261393d4f7a1d5ce60a9215ab
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agolowmem: Split up governor from lowmem module 29/286529/6 accepted/tizen/unified/20230131.162139
SangYoun Kwak [Mon, 9 Jan 2023 08:28:23 +0000 (17:28 +0900)]
lowmem: Split up governor from lowmem module

The lowmem-governor.c was created by extracting the
"sorting out kill candidate" functionality from lowmem.c.
    * Newly created: lowmem-governor.c, lowmem-governor.h
    * "lowmem_governor_get_kill_candidates" function from
      lowmem-governor.c gets a list of procs/apps and returns a sorted
      list of kill candidates.
    * Functions that only used in lowmem-governor.c were moved into
      lowmem-governor.c from lowmem.c.

Change-Id: Ieba1612c040a9891e2f87f44e6bd1a34251f05ea
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agoprocess: Add proc.conf to config rpm 47/287447/2
SangYoun Kwak [Mon, 30 Jan 2023 05:44:34 +0000 (14:44 +0900)]
process: Add proc.conf to config rpm

"proc.conf" file was added to config rpm, which means "proc.conf" file
can be installed when the platform image is created.

Change-Id: Ided05b12fe05b7e8efd0d36d3951b220b07c486b
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agoresource-limiter: Remove unused include 52/287352/1 accepted/tizen/unified/20230130.165633
SangYoun Kwak [Fri, 27 Jan 2023 04:49:49 +0000 (13:49 +0900)]
resource-limiter: Remove unused include

The "file-helper.h" was not used but included in the source code of
lowmem module.

Change-Id: I1d5149b415cb48d6dd43f8c6c02c1b058aa83322
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agoresource-monitor: Remove unused includes 39/287339/2
SangYoun Kwak [Fri, 27 Jan 2023 02:20:47 +0000 (11:20 +0900)]
resource-monitor: Remove unused includes

Some unused includings in the source file of resource-monitor were
removed.

Change-Id: I2584f083cf00482d3eef121afe6006f13112618b
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agoprocess: Remove unused includes 38/287338/2
SangYoun Kwak [Fri, 27 Jan 2023 02:14:44 +0000 (11:14 +0900)]
process: Remove unused includes

Some unused includings in the source files of process were removed.

Change-Id: I411e9486b941b533ef057fdfde3aad1294c7a916
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agoresourced: Remove unused includes 37/287337/2
SangYoun Kwak [Fri, 27 Jan 2023 02:09:08 +0000 (11:09 +0900)]
resourced: Remove unused includes

Some unused includings in the source file of resourced were removed.

Change-Id: Ica3cba7d8cf8a6bc7408d9403562d6d8ed82c06f
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agoresource-optimizer: Remove unused includes 36/287336/1
SangYoun Kwak [Fri, 27 Jan 2023 02:04:02 +0000 (11:04 +0900)]
resource-optimizer: Remove unused includes

Some unused includings in the source files of resource-optimizer were
removed.

Change-Id: Ice4dbd8fac7e6559ccde9ea3d0b4a6ae97462ab5
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agocommon: Remove unused includes 96/287296/2
SangYoun Kwak [Thu, 26 Jan 2023 08:11:59 +0000 (17:11 +0900)]
common: Remove unused includes

Some unused includings in the source files of common were removed.

Change-Id: I360fbf1c3a281b3697b3be03445100cc009e2460
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agoresource-limiter: Remove unused includes 95/287295/1
SangYoun Kwak [Thu, 26 Jan 2023 07:57:57 +0000 (16:57 +0900)]
resource-limiter: Remove unused includes

Some unused includings in the source files of resource-limiter were
removed.

Change-Id: I2f6eb221db364d6cda1af785dfe1a0315d6a207e
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agotests: Remove unused includes 65/287265/2
SangYoun Kwak [Thu, 26 Jan 2023 04:53:57 +0000 (13:53 +0900)]
tests: Remove unused includes

Some unused includings in the source file were removed.

Change-Id: I350cab33dca8c21814037d98492c24043788b499
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
15 months agoprocess: Restore OOM_FIXED_APPS 43/287043/5 accepted/tizen/unified/20230126.170128
SangYoun Kwak [Thu, 19 Jan 2023 03:25:55 +0000 (12:25 +0900)]
process: Restore OOM_FIXED_APPS

The OOM_FIXED_APPS feature fixes the oom score of some applications
specified specified in the proc.conf file.

This feature was removed as follows(reverse chronological order):
    f6c9aab ("Support old style vip cgroup")
    ad81bd2 ("Rearrange memory cgroup")
    740d0f5 ("Rearrange optimizer configuration")
    f2b65a3 ("Update limiter.conf and support realtime")
    a3344a9 ("Support per app(service) management")
    574bf1b ("Add 'PerProcess' configurations")
    36a18bf ("Modify comments & remove useless things")

This feature has been restored by request.

Change-Id: I155a31722f1b5cae446663f690234faee0babe2c
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
16 months agoSplit header file of 'lowmem' module 86/286486/1 accepted/tizen/unified/20230110.164112
SangYoun Kwak [Mon, 9 Jan 2023 03:02:47 +0000 (12:02 +0900)]
Split header file of 'lowmem' module

'lowmem.h' was split into 4 files:
    lowmem.h (lowmem.c)
    lowmem-dbus.h (lowmem-dbus.c)
    lowmem-limit.h (lowmem-limit.c)
    lowmem-system.h (lowmem-system.c)
Each header file is a header of its .c file.

As the 'lowmem.h' was split, source files containing
'lowmem.h' were modified.

Change-Id: Ie1f627f9f818fa741bd257f8d9433fb6c4ec7bb3
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
16 months agoFix the file names of the module 'lowmem' 85/286485/1
SangYoun Kwak [Mon, 9 Jan 2023 02:29:40 +0000 (11:29 +0900)]
Fix the file names of the module 'lowmem'

The header and source files of 'lowmem' were fixed:
    src/resource-limiter/memory/vmpressure-lowmem-handler.c
        -> src/resource-limiter/memory/lowmem.c
    src/resource-limiter/memory/lowmem-handler.h
        -> src/resource-limiter/memory/lowmem.h
As the header(lowmem.h) was renamed, source files
containing 'lowmem-handler.h' were modified.
(#include 'lowmem-handler.h' -> #include 'lowmem.h')
    src/process/proc-main.c
    src/resource-limiter/memory/lowmem-dbus.c
    src/resource-limiter/memory/lowmem-limit.c
    src/resource-limiter/memory/lowmem-system.c
    src/resource-optimizer/memory/swap/fileswap.c
    src/resource-optimizer/memory/swap/zramswap.c
    src/resource-optimizer/memory/swap/zswap.c

Change-Id: Ib325c825d23f659aebcf832401023c8a280e25b2
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
16 months agoRemove unnecessary '#include "lowmem-handler.h"' 84/286484/1
SangYoun Kwak [Mon, 9 Jan 2023 02:15:40 +0000 (11:15 +0900)]
Remove unnecessary '#include "lowmem-handler.h"'

In the files below, the "lowmem-handler.h" was included
but its symbols were never used.
    src/common/procfs/procfs.c
    src/process/proc-priority.c
    src/resource-optimizer/memory/dedup.c
    src/resource-optimizer/memory/swap/swap.c
    src/resourced/init.c
Thus, unnecessary includes were removed.

Change-Id: I6bfa6bb31a27109a797a0857affa66c5a486c68c
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
16 months agoModify README of config files 53/286353/4 accepted/tizen/unified/20230109.150958
SangYoun Kwak [Wed, 4 Jan 2023 09:21:26 +0000 (18:21 +0900)]
Modify README of config files

The README of config files was renewed
because its content was out-dated.

Below are the changes:
1. Format
Now the key and value of the properties are described
separately.
For more accurate explanation, keys and values are described
using regular expression.

2. Contents were renewed about files below(config for common):
limiter.conf
optimizer.conf
monitor.conf
process.conf

3. Contents were added(config for each app):
limiter.conf.d/*.conf
optimizer.conf.d/*.conf
process.conf.d/*.conf
vip-process.d/*.conf

Change-Id: I585f6382b1ddff6d1458586a05b5fe92cf715b91
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
19 months agofd-handler: add context information 37/282237/2
Unsung Lee [Thu, 29 Sep 2022 02:48:28 +0000 (11:48 +0900)]
fd-handler: add context information

Change-Id: I11f4049f4141a6c87235b7b65ab6a7a101cb2abc
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
19 months agocpu-boosting: check return value of 'unlink' 97/282097/6 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.061541 accepted/tizen/7.0/unified/hotfix/20221116.105753 accepted/tizen/unified/20220928.020843 tizen_7.0_m2_release
Unsung Lee [Tue, 27 Sep 2022 04:48:12 +0000 (13:48 +0900)]
cpu-boosting: check return value of 'unlink'

Change-Id: Ia21839c980a252309546f6f9ea7fc588f57ec03c
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
19 months agoMount watchdog cgroup early 84/282084/1
Unsung Lee [Tue, 27 Sep 2022 02:59:20 +0000 (11:59 +0900)]
Mount watchdog cgroup early

Change-Id: I3124c7a6fb97e98fa3fa11f30d765de741e199fa
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
19 months agoTurn on heart-cpu for tct 02/281902/1 accepted/tizen/unified/20220927.132315
Unsung Lee [Fri, 23 Sep 2022 05:43:18 +0000 (14:43 +0900)]
Turn on heart-cpu for tct

Change-Id: Ifce9a9881194450320788a6d249bb0763e7c5925
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
20 months agoFix Coverity reported bugs 40/280940/2 accepted/tizen/unified/20220908.124842
Unsung Lee [Wed, 7 Sep 2022 03:00:23 +0000 (12:00 +0900)]
Fix Coverity reported bugs

Change-Id: I18665f0d2e66ef94a05fc055d35c0cce8876d1ec
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
20 months agoRename signal name 34/280934/1 accepted/tizen/unified/20220908.013426
Unsung Lee [Wed, 7 Sep 2022 02:17:49 +0000 (11:17 +0900)]
Rename signal name

Change-Id: I1e6fdd50c6894b74d843ba2e375253d36515a444
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
20 months agoFix memory size of dest_process 90/280390/1 accepted/tizen/unified/20220902.020126 submit/tizen/20220901.095920
Unsung Lee [Mon, 29 Aug 2022 10:17:36 +0000 (19:17 +0900)]
Fix memory size of dest_process

Change-Id: Ibc27ad11c958ae000391381d6c90ed00106bb36f
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
20 months agoIncrease MemLimit of resourced 56/280356/1
Unsung Lee [Mon, 29 Aug 2022 04:54:18 +0000 (13:54 +0900)]
Increase MemLimit of resourced

ASAN-enabled image requires more memory

Change-Id: I8ff8b2c628021865437344ff031a07d121c59c65
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
20 months agoFix SVACE reported bugs 45/280345/1
Unsung Lee [Mon, 29 Aug 2022 01:35:45 +0000 (10:35 +0900)]
Fix SVACE reported bugs

Change-Id: Iffde2d9dcc0b5a76f28e1ac899f673f9417bf89c
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
20 months agoFix Coverity reported bugs 72/280272/1
Unsung Lee [Fri, 26 Aug 2022 04:48:12 +0000 (13:48 +0900)]
Fix Coverity reported bugs

Change-Id: I639b29f936bf3b9bdf5bab7da71008336a4b7fd6
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
21 months agoRearrange files and directories 04/279704/1 accepted/tizen/unified/20220824.135639 submit/tizen/20220822.111221
Unsung Lee [Tue, 16 Aug 2022 11:18:12 +0000 (20:18 +0900)]
Rearrange files and directories

Change-Id: I2fd8069de754a50f9c2f3094ac87dcd014d4b44a
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
21 months agocpu-boosting: add (un)register and get/set inherit 00/279500/6 submit/tizen/20220816.062425
Unsung Lee [Wed, 10 Aug 2022 09:01:03 +0000 (18:01 +0900)]
cpu-boosting: add (un)register and get/set inherit

Change-Id: I99fa6e6aba0ecd59b731b089245e63d4d3c156bd
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
21 months agoFix SVACE reported bugs 67/278767/1
Unsung Lee [Tue, 26 Jul 2022 02:40:42 +0000 (11:40 +0900)]
Fix SVACE reported bugs

Change-Id: Ib1dd6764373e52fda332b7bdebbc55b5178e6045
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
21 months agoRename flag -> flags 00/278600/2 accepted/tizen/unified/20220726.132018 submit/tizen/20220725.093537
Unsung Lee [Fri, 22 Jul 2022 08:02:28 +0000 (17:02 +0900)]
Rename flag -> flags

Change-Id: I85bd5311936f7e3feb0890a352d9a50c0a063867
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
21 months agoDo not make backups for original policy, privilege 71/278571/2
Unsung Lee [Fri, 22 Jul 2022 06:01:34 +0000 (15:01 +0900)]
Do not make backups for original policy, privilege

Change-Id: Iba447a08455780d898718b709b8fb9dffba2a693
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
21 months agoSupport CPU_BOOSTING_RESET_ON_FORK 59/278559/2 submit/tizen/20220722.040856
Unsung Lee [Fri, 22 Jul 2022 03:51:19 +0000 (12:51 +0900)]
Support CPU_BOOSTING_RESET_ON_FORK

Change-Id: Ic494e5bee8a082aa629af47c1af73d333c340c58
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
22 months agoModify conf value 91/278291/1
Unsung Lee [Mon, 18 Jul 2022 11:43:54 +0000 (20:43 +0900)]
Modify conf value

Change-Id: I2a9ebb74f0f8580f0b6b554a7aa399db424ce59a
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
22 months agoDelegate socket activation to a booster thread 19/277919/2 accepted/tizen/unified/20220719.131728 submit/tizen/20220718.101839
Unsung Lee [Fri, 15 Jul 2022 05:03:11 +0000 (14:03 +0900)]
Delegate socket activation to a booster thread

Change-Id: Ie9d2e928f60b8d1322f73697c459a8f74d80b22e
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
22 months agoDeactivate exit-on-close and activate SIGTERM 77/277777/3
Unsung Lee [Wed, 13 Jul 2022 07:10:25 +0000 (16:10 +0900)]
Deactivate exit-on-close and activate SIGTERM

Change-Id: I8e56f20367dd71d06f1d2c11f05534cdb3349795
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
22 months agocpu-boosting: implement get func 15/277715/1
Unsung Lee [Tue, 12 Jul 2022 08:55:40 +0000 (17:55 +0900)]
cpu-boosting: implement get func

+ separate set and clear funcs

Change-Id: I320824c23092d5b4ae0eff23559ab1dbc38f098a
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
22 months agoFix a bug referenced a dangling pointer 04/277704/1
Unsung Lee [Tue, 12 Jul 2022 08:00:37 +0000 (17:00 +0900)]
Fix a bug referenced a dangling pointer

Change-Id: I9db99145b0b07c077e86eb972d4a511f5288e203
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
22 months agoFix Coverity reported bugs 71/277371/1 accepted/tizen/unified/20220706.120407 submit/tizen/20220706.042647
Unsung Lee [Wed, 6 Jul 2022 01:43:33 +0000 (10:43 +0900)]
Fix Coverity reported bugs

Change-Id: I775471ffdb69309113e245963260ddc747f57b5d
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>
22 months agoSupport old style vip cgroup 39/277339/6 submit/tizen/20220705.100432
Unsung Lee [Tue, 5 Jul 2022 08:39:15 +0000 (17:39 +0900)]
Support old style vip cgroup

+ add Process type of configuration

Change-Id: Idcc4b1a6da27160a9c164699006cabe17a72cdef
Signed-off-by: Unsung Lee <unsung.lee@samsung.com>