platform/core/system/resourced.git
6 years agoswap: change lmk type for searching all processes in case of zram full 10/187510/4
WaLyong Cho [Wed, 28 Jun 2017 01:44:09 +0000 (10:44 +0900)]
swap: change lmk type for searching all processes in case of zram full

Change-Id: I9424f277b0e191ae7761090b308e4c901bd55d25
Signed-off-by: WaLyong Cho <walyong.cho@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoswap: control swappiness dynamically 09/187509/4
ByungSoo Kim [Tue, 13 Jun 2017 05:31:25 +0000 (14:31 +0900)]
swap: control swappiness dynamically

User space can control amount of swap by changing swappiness value.
Resourced swap can have basically two strategies.
- set default swappiness (60) before triggering force reclaim node.
  : Setting the value to the force reclaim node means to save memory as much as possilbe.
    But, if it has smaller swappiness value, there is no impact.
    Therefore, even though it has low swappiness value such as zero,
    use default swappiness value (60) before writing node and restore previous value after reclaiming.
- set minimum swappiness in case of swap full
  : If swap device is not enough space, trying to swap memory will be overhead.
    While resourced triggers early LMK, it should have minimum value.

Change-Id: If3ba566caf41a73bb22620b8e7f2403303a067be
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoswap: check kernel fragmentation through /proc/buddyinfo 08/187508/4
ByungSoo Kim [Tue, 13 Jun 2017 05:27:12 +0000 (14:27 +0900)]
swap: check kernel fragmentation through /proc/buddyinfo

Most kernel doesn't support migration and compaction of zmalloc.
So, if zmalloc uses much kernel memory and makes fragmentation,
there is no high order buddy and it causes the failure of fork().

Change-Id: I5407d5d53bbcc2facb85b4482cff5ddfb536201d
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoswap: trigger early LMK when swap space is not enough. 07/187507/4
ByungSoo Kim [Tue, 13 Jun 2017 05:11:40 +0000 (14:11 +0900)]
swap: trigger early LMK when swap space is not enough.

If swap device is almost full and there is no improvement to compact zram,
it means that there are many background processes or some process makes memory leak.
It will sometime make a sluggish or hangup issue.
So, it requires to trigger proactive oom killer.
Especially in case of zram, it is necessary to check memory usage of swap cgroup.
If it is enough, trigger reclaiming memory about background applications.
Otherwise, find mallicious process in all memory cgroups.

Change-Id: I14e97f7e1b58545de221ff5cf1a674153d9e98a5
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agolowmem: add new api for triggering early LMK in swap module 06/187506/4
ByungSoo Kim [Tue, 13 Jun 2017 04:58:01 +0000 (13:58 +0900)]
lowmem: add new api for triggering early LMK in swap module

If swap devices are almost full, it can make sluggish issue.
So, it requries to trigger early LMK in swap modules.
And it is necessary to insert LMK type in order to decide
whether LMK will kill background applications or find out mallicious system daemons.

Change-Id: I6e215f41ec1b3282f15f67f8df81439f9f21fba8
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agolowmem: unified function for triggering LMK 05/187505/4
ByungSoo Kim [Tue, 13 Jun 2017 04:47:48 +0000 (13:47 +0900)]
lowmem: unified function for triggering LMK

There are many points to trigger LMK inspite of not OOM case.
It can be unified with multiple variables.
If there is no value in input argument, it will use default value.

Change-Id: I76d8bca7c817396a810d77540851d1841375b68b
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoswap: add new module for zswap 04/187504/4
ByungSoo Kim [Tue, 13 Jun 2017 04:39:27 +0000 (13:39 +0900)]
swap: add new module for zswap

zswap is similar with zram+file swap.
But it has own pool size named zpool and requires "CONFIG_ZSWAP" kernel configuration.
And it uses SWAP_PRI_DISABLE priority
so it will be enabled alone in spite of declaring multiple swap devices
in config file.
Moreover duplicated functions with fileswap move common swap code.

Change-Id: Id35a30f59fe072ea22a8a5be6504e4836ddceaa1
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoswap: control priority about multiple swap devices 03/187503/4
ByungSoo Kim [Tue, 13 Jun 2017 04:28:26 +0000 (13:28 +0900)]
swap: control priority about multiple swap devices

Give different priority value to multiple swap devices.
Each swap modules can have four types such as
disable, low, default, high.
Swap list of kernel has low-to-high order
while swap ordering is high-to-low.
If swap priority is low, it will be initialized eariler in resourced.
And if some module has SWAP_PRI_DISABLE,
it doesn't allow to add other swap devices.

However, if all swap devices are enabled with priority,
it can't be changed at runtime.

Change-Id: If6a467fa49364fa26ec7d870a31f968b94b7b19f
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoswap: add new module for fileswap 02/187502/4
ByungSoo Kim [Tue, 13 Jun 2017 04:21:16 +0000 (13:21 +0900)]
swap: add new module for fileswap

fileswap will be supported after mounting loop device with crypto.

Change-Id: I7852f25c78b9b62a7b0e8dae74bd2d64dc916090
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agocommon: add losetup() api for supporting loop device in resourced 01/187501/4
ByungSoo Kim [Tue, 13 Jun 2017 04:10:19 +0000 (13:10 +0900)]
common: add losetup() api for supporting loop device in resourced

The function losetup sets up and controls loop devices.
Resourced will use this api in order to generalize loop device and use crypto.

Change-Id: Ic6677d67cb3361492db12ded809413f1778e4a04
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoswap: modulize zram swap 00/187500/4
ByungSoo Kim [Tue, 13 Jun 2017 01:38:08 +0000 (10:38 +0900)]
swap: modulize zram swap

Move all zram functions to modulized zramswap.c file.
Main swap.c operates only swap thread and call ops functions.

Change-Id: I4ab5c07f5c2cd045c03ef87f8e75f82425fe86c3
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoproc: add new api for getting /proc/swaps information 99/187499/4
Paweł Szewczyk [Thu, 23 Aug 2018 11:07:43 +0000 (13:07 +0200)]
proc: add new api for getting /proc/swaps information

/proc/swaps provides many information about swap status.
But it requires parsing each argument.
So proc will support new api and structure.

Change-Id: Icde84b89c7a9215b57fdf55c910f31d05c82e2f2
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agocommon: provide parsing multiple data types 98/187498/4
ByungSoo Kim [Tue, 13 Jun 2017 02:34:22 +0000 (11:34 +0900)]
common: provide parsing multiple data types

add define_parser macro in order to support parsing multiple data types.
It came from systemd after changing arguments.
It can be moved to support these apis in libsystem.

Change-Id: Iee4599293b486baf59fc1a499cf27e1ab6472794
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoconfig-parser: add new style config parser 97/187497/4
ByungSoo Kim [Fri, 17 Feb 2017 11:56:32 +0000 (20:56 +0900)]
config-parser: add new style config parser

The new api config_parse_new() is added to parse the ini formatted
config fille.
It comes from tizen 2.4.

Change-Id: I04d49fd473046d9387398570b218287e77acf894
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoswap: prepare modulization of swap devices 96/187496/3
ByungSoo Kim [Mon, 12 Jun 2017 14:22:18 +0000 (23:22 +0900)]
swap: prepare modulization of swap devices

Resourced swap can support multiple swap devices.
It makes new structure with each callback and new api for adding modules.

Change-Id: I1b243f00032541ee2a5d320c1aff322a599a9a39
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agomemory: use path name for getting memcg info instead of mi structure 95/187495/3
ByungSoo Kim [Mon, 12 Jun 2017 13:19:45 +0000 (22:19 +0900)]
memory: use path name for getting memcg info instead of mi structure

Only lowmem module knows all lists of memcg structure.
But other modules sometimes want to get memcg information.
so, it is better to use path name.
And, the function cgroup_get_memory_stat supports to get memory.stat
more easily with gperf lookup table.

Change-Id: Ica1ebfae95d0b0260d65a2ee50d5bced90a90e68
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoswap: remove unused dbus signal 94/187494/3
ByungSoo Kim [Mon, 12 Jun 2017 13:00:52 +0000 (22:00 +0900)]
swap: remove unused dbus signal

It was old code which no one uses dbus call for getting swap status.

Change-Id: Iedadd0244799bcaf0a52615f7d92b8c400557525
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoswap: check swap status whether kernel enables configurations 91/187491/3
ByungSoo Kim [Mon, 12 Jun 2017 12:50:18 +0000 (21:50 +0900)]
swap: check swap status whether kernel enables configurations

don't assume that resourced can only support zram.
resourced will support multiple swap scenarios such as zram, file and zswap.
But instead, kernel should enable MEMCG_SWAP.

Change-Id: I3786e434601095460216d3b952d6a920422d6d74
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoFail module logging initalization if logging_init() fails 53/189653/1 accepted/tizen_5.0_unified accepted/tizen/5.0/unified/20181102.021616 accepted/tizen/unified/20180920.155224 submit/tizen/20180920.072124 submit/tizen_5.0/20181101.000004
Łukasz Stelmach [Wed, 19 Sep 2018 10:04:50 +0000 (12:04 +0200)]
Fail module logging initalization if logging_init() fails

This will probably prevent the whole module from initializing properly,
if it requires logging, but prevents the whole resourced from blowing up.

Change-Id: Ic7a544a1fe66402e20a4974f006c3d5fd09aa7af
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoAvoid iterating over a NULL hash 73/189573/1 submit/tizen/20180919.012109
Łukasz Stelmach [Tue, 18 Sep 2018 14:37:46 +0000 (16:37 +0200)]
Avoid iterating over a NULL hash

Change-Id: I7f783bf192bb27e9d3748208d8f9a551420dc298
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoMerge "heart: Ignore unknown sections in config file" into tizen
Lukasz Stelmach [Mon, 17 Sep 2018 09:08:38 +0000 (09:08 +0000)]
Merge "heart: Ignore unknown sections in config file" into tizen

6 years agoMerge "Simplify D-Bus policy" into tizen
Lukasz Stelmach [Fri, 14 Sep 2018 14:02:57 +0000 (14:02 +0000)]
Merge "Simplify D-Bus policy" into tizen

6 years agoSimplify D-Bus policy 98/187798/2
Karol Lewandowski [Tue, 28 Aug 2018 10:53:11 +0000 (12:53 +0200)]
Simplify D-Bus policy

This change should bring no functional changes but it makes policy
much easier to read and iterpret.

Change-Id: Icd92de3074b44f26dea7b53e82158d929365dcc5
Suggested-by: SangHyeok Oh <sangheyok.oh@samsung.com>
6 years agofix zombie thread by detaching to avoid resource leak 51/188051/1 accepted/tizen/unified/20180831.165151 submit/tizen/20180830.162343
Ravi Guntur [Tue, 20 Mar 2018 05:06:40 +0000 (10:36 +0530)]
fix zombie thread by detaching to avoid resource leak

Signed-off-by: Ravi Guntur <ravi.g@samsung.com>
Change-Id: I8ee2881eb91474ecbddd6b42e1795df3fc5e28ac

6 years agoheart: Ignore unknown sections in config file 21/187821/1
Paweł Szewczyk [Tue, 28 Aug 2018 15:00:35 +0000 (17:00 +0200)]
heart: Ignore unknown sections in config file

Config file heart.conf contains sections other than [HEART]. They should
not cause this file parsing to fail, we can just ignore them.

Change-Id: I5116731b4d79cb7cc60b578443a942bdb754d077

6 years agoMerge "Update the ProcessCrashed signal signature" into tizen accepted/tizen/unified/20180824.162514 submit/tizen/20180822.121814 submit/tizen/20180823.142438
Mateusz Moscicki [Wed, 22 Aug 2018 11:03:10 +0000 (11:03 +0000)]
Merge "Update the ProcessCrashed signal signature" into tizen

6 years agoUpdate the ProcessCrashed signal signature 68/186568/1
Mateusz Moscicki [Thu, 9 Aug 2018 07:20:21 +0000 (09:20 +0200)]
Update the ProcessCrashed signal signature

Change-Id: I3a924889e0ca0e0385ed72f76fc9e4370bda13e6

6 years agoFix inconsistent string ownership 12/185812/2
Michal Bloch [Thu, 2 Aug 2018 11:42:44 +0000 (13:42 +0200)]
Fix inconsistent string ownership

Usually the PPI structure owns its own strdup'd copy of the pkgname string.
However, sometimes it shared it in a non-owning way with another structure
which risked the possibility of trying to use it after that other structure
had already been destroyed.

Change-Id: I71433d24137ef8e96325e9a2aeece53b51b079b5
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoheart : remove PID argument of D-Bus 94/185194/2
Kichan Kwon [Fri, 27 Jul 2018 01:53:42 +0000 (10:53 +0900)]
heart : remove PID argument of D-Bus

Change-Id: Id6f91871513d322a38d34c43be8b2438b903b4f6
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agoDisable "reboot on VIP death" behavior on poweroff 60/183760/9 accepted/tizen/unified/20180727.063754 submit/tizen/20180726.113419
Michal Bloch [Fri, 13 Jul 2018 13:47:52 +0000 (15:47 +0200)]
Disable "reboot on VIP death" behavior on poweroff

This is done because it is normal for VIPs to die throughout a poweroff,
yet having the poweroff replaced by a reboot is undesirable.

Beware: there is a fallback that mounts (binds) `/bin/true`
as the usual release agent, `/usr/bin/vip-release-agent`,
which might cause surprises if the system somehow survives
the shutdown (e.g. because it is disabled for debugging).

Change-Id: I15c40a681de2f58aceb66862988f15ef454b6f8a
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoDon't listen to DeviceD power off signal 84/184384/4 accepted/tizen/unified/20180725.060434 submit/tizen/20180724.051636
Michal Bloch [Tue, 17 Jul 2018 13:10:54 +0000 (15:10 +0200)]
Don't listen to DeviceD power off signal

DeviceD currently sends the ChangeState signal on the PowerOff interface,
which causes resourced's main loop to quit, before the PrePowerOff method
is called (which then is not handled). With PrePowerOff uncalled, the VIP
cgroup is left mounted, which causes the platform to reboot on the death
of any VIP process. This makes it impossible to do a regular poweroff as
VIPs die throughout which replaces the poweroff with a reboot.

Removing the signal handler is safe as the signal is somewhat redundant.
Quitting the main loop happens eventually regardless since at some point
DeviceD sends SIGTERM (which also quits the main loop).

Change-Id: I552e4575ad97ae377a96daa0cba24bbe03c0d3bf
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
6 years agoUse update-alternatives to manage resourced.common and resourced.light 85/181685/3 accepted/tizen/unified/20180620.131530 submit/tizen/20180619.111527
Łukasz Stelmach [Thu, 14 Jun 2018 14:30:04 +0000 (16:30 +0200)]
Use update-alternatives to manage resourced.common and resourced.light

Build both resourced.common and resourced.light with a single spec
file. Use symbolic links managed with update-alternatives to provide
/usr/bin/resourced with either of binaries.

Change-Id: I4d8a1e90a6b09ef55063e3fcffbfe636638635a3
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoRevert "Build resourced-light with a separate spec" 84/181684/1
Łukasz Stelmach [Fri, 15 Jun 2018 12:47:54 +0000 (14:47 +0200)]
Revert "Build resourced-light with a separate spec"

This reverts commit 2c98c32aadc7758430786aa822464e73484c6a1c.

Change-Id: Id3dccca129cdd71171a23b354c46a52dc1d96c91

6 years agoMerge "Refactor dbus_heart_get_cpu_data() and heart_cpu_get_data() functions" into...
Karol Lewandowski [Wed, 13 Jun 2018 14:55:44 +0000 (14:55 +0000)]
Merge "Refactor dbus_heart_get_cpu_data() and heart_cpu_get_data() functions" into tizen

6 years agoAllow access to battery information for unprivileged processes 59/181159/2
Łukasz Stelmach [Fri, 8 Jun 2018 14:57:51 +0000 (16:57 +0200)]
Allow access to battery information for unprivileged processes

It appears battery information should be available to unprivileged
processes. Tizen documentation[1] does not mention any privileges are
required to access the information.

[1] https://developer.tizen.org/development/guides/web-application/w3chtml5supplementary-features/device/battery-status

Change-Id: I495cc9c83bcc7bc1cd3e7b8bc42d1fc661ed1137
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoExpose ProcExclude as a method call 79/178579/4
Łukasz Stelmach [Fri, 4 May 2018 13:23:34 +0000 (15:23 +0200)]
Expose ProcExclude as a method call

Change-Id: I1fa8be9305d50d8c27924e6e94785cb888731b74
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoImprove dbus message handling 78/178578/3
Łukasz Stelmach [Wed, 2 May 2018 13:31:27 +0000 (15:31 +0200)]
Improve dbus message handling

Change-Id: Ibc679a21c2a6eb588d9dfcfa86b8f5dff3d9016c
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoRefactor dbus_heart_get_cpu_data() and heart_cpu_get_data() functions 66/180066/2
Łukasz Stelmach [Thu, 24 May 2018 12:20:51 +0000 (14:20 +0200)]
Refactor dbus_heart_get_cpu_data() and heart_cpu_get_data() functions

Remove duplicated code from dbus_heart_get_cpu_data() leaving only DBus
interfacing code. Call heart_cpu_get_data() to retrieve data.

Change-Id: I2f19a164507e3dfedccd93b75524f1734c5850cb
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoMerge "Bump version of the resourced-light package" into tizen
Łukasz Stelmach [Thu, 24 May 2018 12:49:59 +0000 (12:49 +0000)]
Merge "Bump version of the resourced-light package" into tizen

6 years agoBump version of the resourced-light package 50/180050/1
Łukasz Stelmach [Thu, 24 May 2018 11:00:59 +0000 (13:00 +0200)]
Bump version of the resourced-light package

Change-Id: Id731eea1dd77ec1c99f597c884f57f69b1b7f4b9
Fixes: 875a2080
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoMerge "Enable swap module in resourced-light" into tizen
Karol Lewandowski [Wed, 23 May 2018 14:39:53 +0000 (14:39 +0000)]
Merge "Enable swap module in resourced-light" into tizen

6 years agoUse the sysfs interface for zram introduced in Linux 4.11 19/179819/1
Łukasz Stelmach [Tue, 22 May 2018 10:34:55 +0000 (12:34 +0200)]
Use the sysfs interface for zram introduced in Linux 4.11

Change-Id: If6a5132f0727feddb4acdb462b64409881038c20
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoIntroduce functions to read an n-th field from a file 18/179818/1
Łukasz Stelmach [Tue, 22 May 2018 10:04:27 +0000 (12:04 +0200)]
Introduce functions to read an n-th field from a file

Change-Id: I4d3c13f684968240b41fedc76ec3274889ff318a
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoMove fwrite_array() next to other write functions 17/179817/1
Łukasz Stelmach [Tue, 22 May 2018 10:03:38 +0000 (12:03 +0200)]
Move fwrite_array() next to other write functions

Change-Id: I62c6b0dcaa8d92b4b8de01e27b5b38a8157208fa
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoEnable swap module in resourced-light 70/176070/2
Mateusz Moscicki [Mon, 16 Apr 2018 09:11:32 +0000 (11:11 +0200)]
Enable swap module in resourced-light

Change-Id: I2e191cf69449950a953273e116cb0e44caaf2230

6 years agoMerge "Set the default DBus policy for send and own to deny" into tizen submit/tizen/20180523.100558
Karol Lewandowski [Thu, 17 May 2018 13:20:00 +0000 (13:20 +0000)]
Merge "Set the default DBus policy for send and own to deny" into tizen

6 years agoMerge "Build resourced-light with a separate spec" into tizen
Karol Lewandowski [Thu, 17 May 2018 13:16:00 +0000 (13:16 +0000)]
Merge "Build resourced-light with a separate spec" into tizen

6 years agorelease : 0.5.4 77/178777/1 accepted/tizen/unified/20180515.063724 submit/tizen/20180514.045434
Kichan Kwon [Mon, 14 May 2018 04:40:09 +0000 (13:40 +0900)]
release : 0.5.4

Change-Id: I7012181cad6a50657d23b372721ad517954424e5
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agoSet the default DBus policy for send and own to deny 26/178726/1
Łukasz Stelmach [Fri, 11 May 2018 11:45:54 +0000 (13:45 +0200)]
Set the default DBus policy for send and own to deny

Change-Id: If607185a252fc7d15b603aeb8e0065c643631726
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agoClear Gerror before exit 21/178621/1
Kichan Kwon [Fri, 11 May 2018 02:14:50 +0000 (11:14 +0900)]
Clear Gerror before exit

Change-Id: I0915d884811234dd8e36a6788bd3a6b1d531c01b
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agoBuild resourced-light with a separate spec 11/177111/2
Łukasz Stelmach [Fri, 20 Apr 2018 12:19:35 +0000 (14:19 +0200)]
Build resourced-light with a separate spec

Due to limitations of RPM it is impossible to build two RPM packages
containing files with different content and the same name. To work
around this limitation we create a separate spec in the repository to
avoid renaming binaries in %post scripts, which messes the RPM database
and makes it impossible to discover the origin of the binary.

Change-Id: I7d71096237320e1cbf878e9cbaa48c767d9c7fce

6 years agoFix heap-use-after-free error detected by Adress Sanitizer. 17/178117/1 submit/tizen/20180509.124204
Elmurod Talipov [Mon, 30 Apr 2018 02:50:11 +0000 (11:50 +0900)]
Fix heap-use-after-free error detected by Adress Sanitizer.

 - rt_task is released in proc_runtime_info_task_cb(), when
   proc_runtime_info_task() is called, and result is written to pipe.
   This happens before the thread is finished, which will create problem
   for accessing rt_task->task_name.

Change-Id: I8eea8e05aef80250d48a9046cdcc26a2681df3ae
Signed-off-by: Elmurod Talipov <e.talipov@samsung.com>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agorelease : 0.5.3 27/171927/1 accepted/tizen/unified/20180313.162811 submit/tizen/20180308.070108
Kichan Kwon [Thu, 8 Mar 2018 07:00:04 +0000 (16:00 +0900)]
release : 0.5.3

Change-Id: I60c8344f159820b1499a92ee2b8afe41bec887b1
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agoMerge remote-tracking branch 'origin/tizen_4.0' into tizen 19/171919/1
Kichan Kwon [Thu, 8 Mar 2018 06:07:35 +0000 (15:07 +0900)]
Merge remote-tracking branch 'origin/tizen_4.0' into tizen

Change-Id: I0802f410007bcb2ce798f640972a7840274447ce
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agomemory : ignore empty zone 06/171906/2
Kichan Kwon [Thu, 8 Mar 2018 05:54:04 +0000 (14:54 +0900)]
memory : ignore empty zone

- Some devices make a zone but don't allocate any pages for it
- In addition, fix divided by zero

Change-Id: Ifb11ce58384b0731706f5366a491ddb9f422fc90
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agovip : assign "System" exec label to enable access to "/sys/fs/cgroup/vip" 29/171329/1 accepted/tizen/4.0/unified/20180307.071414 submit/tizen_4.0/20180302.135759
Łukasz Stelmach [Thu, 1 Mar 2018 11:21:59 +0000 (12:21 +0100)]
vip : assign "System" exec label to enable access to "/sys/fs/cgroup/vip"

Change-Id: I6ad3ab3aec3c16410ebf92862b99dcaa50e20fe4
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
6 years agocommon: Fix off-by-one error in prog_find_match 61/168861/1 accepted/tizen/4.0/unified/20180228.140806 submit/tizen_4.0/20180228.071159
Paweł Szewczyk [Mon, 22 Jan 2018 16:45:41 +0000 (17:45 +0100)]
common: Fix off-by-one error in prog_find_match

Change-Id: I74743114e9fd8ce8975346aea5218c9696e770f3
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoproc: Fix handling already terminated process 60/168860/1
Paweł Szewczyk [Mon, 22 Jan 2018 14:55:41 +0000 (15:55 +0100)]
proc: Fix handling already terminated process

There is no reason to allocate app info if main pid was terminated.

Change-Id: I2cb2c2568bd0a284caf0973fc84aa6124470b168
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agocommon: Fix off-by-one error in prog_find_match 84/167884/1 accepted/tizen/unified/20180130.055213 submit/tizen/20180129.125325
Paweł Szewczyk [Mon, 22 Jan 2018 16:45:41 +0000 (17:45 +0100)]
common: Fix off-by-one error in prog_find_match

Change-Id: I74743114e9fd8ce8975346aea5218c9696e770f3
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoproc: Fix handling already terminated process 83/167883/1
Paweł Szewczyk [Mon, 22 Jan 2018 14:55:41 +0000 (15:55 +0100)]
proc: Fix handling already terminated process

There is no reason to allocate app info if main pid was terminated.

Change-Id: I2cb2c2568bd0a284caf0973fc84aa6124470b168
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
6 years agoRemove const from module_ops variable 30/163530/1 accepted/tizen/unified/20171212.064728 submit/tizen/20171212.021838
Kichan Kwon [Tue, 12 Dec 2017 02:09:54 +0000 (11:09 +0900)]
Remove const from module_ops variable

- .initialized will be modified

Change-Id: I4cefcf8dd8efcacbaf3e9023c726ae8e3366ebd4
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agoRemove const from module_ops variable 24/163524/1 accepted/tizen/4.0/unified/20171212.064809 submit/tizen_4.0/20171212.021715 submit/tizen_4.0/20180202.144218 tizen_4.0.IoT.p2_release
Kichan Kwon [Tue, 12 Dec 2017 02:09:54 +0000 (11:09 +0900)]
Remove const from module_ops variable

- .initialized will be modified

Change-Id: I4cefcf8dd8efcacbaf3e9023c726ae8e3366ebd4
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agorelease : 0.5.2 53/162253/1 accepted/tizen/unified/20171130.113317 submit/tizen/20171130.023107
Kichan Kwon [Thu, 30 Nov 2017 02:23:59 +0000 (11:23 +0900)]
release : 0.5.2

Change-Id: I70f76fd7baba633add1433a3a464485b93f51342
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agotimer-slack : remove timer-slack module 59/159959/2
Kichan Kwon [Tue, 14 Nov 2017 02:44:21 +0000 (11:44 +0900)]
timer-slack : remove timer-slack module

Change-Id: If2f351cb27608f92e0b87fc3c3cf189b1dd7a316
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agoMerge remote-tracking branch 'origin/tizen_4.0' into tizen 51/162251/1
Kichan Kwon [Thu, 30 Nov 2017 02:21:10 +0000 (11:21 +0900)]
Merge remote-tracking branch 'origin/tizen_4.0' into tizen

Change-Id: Ia8b39adc5b14870c9bf1a317180ca60196158023
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agoFix contradictory package dependency 44/162244/1 accepted/tizen/4.0/unified/20171205.155502 submit/tizen_4.0/20171130.083142
Kichan Kwon [Thu, 30 Nov 2017 01:40:18 +0000 (10:40 +0900)]
Fix contradictory package dependency

Change-Id: I860504eaa4af53662d83554b402f6e35c3bc839c
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agoproc-stat : replace proc-exclude to watchdog-exclude 03/160903/7 accepted/tizen/4.0/unified/20171130.063628 submit/tizen_4.0/20171129.083912 submit/tizen_4.0/20171129.102443
Kichan Kwon [Mon, 20 Nov 2017 09:56:15 +0000 (18:56 +0900)]
proc-stat : replace proc-exclude to watchdog-exclude

- To simplicate config files
- You can use fixed OOM not to control OOM score
- To exclude your app from watchdog, modify proc.conf

Change-Id: I0cf866a9789f9081b84b64705782f6accce5635a
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
6 years agoproc-stat : block modifying the OOM-fixed app's score 42/159742/6
Kichan Kwon [Mon, 13 Nov 2017 01:45:42 +0000 (10:45 +0900)]
proc-stat : block modifying the OOM-fixed app's score

- We can't control widget's OOM score with existing mechanism
  because widget's score is modified not via set_foregrd(backgrd)
- For performance, make another hashtable using PID as the key

Change-Id: Ib89c84cf6062c0f4d73438b2425234422d2eb2b3
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agorelease : 0.5.1 40/159840/1 submit/tizen/20171113.074827 submit/tizen/20171113.075016 submit/tizen/20171113.081738
Kichan Kwon [Mon, 13 Nov 2017 07:37:13 +0000 (16:37 +0900)]
release : 0.5.1

Change-Id: I084ccf5ea4851018e616eed0e0ea12230ea252b5
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoproc-stat : introduce oom-fixed app 11/157111/4
Kichan Kwon [Mon, 23 Oct 2017 09:28:29 +0000 (18:28 +0900)]
proc-stat : introduce oom-fixed app

- Predefine in proc.conf
- It's oom_score_adj will be fixed without fg/bg status

Change-Id: Id87ea6280c4932db904fb1d40eaf6b7b5327c4e5
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoDetach block, freezer, and swap from resourced-light 35/159535/1
Kichan Kwon [Thu, 9 Nov 2017 11:40:48 +0000 (20:40 +0900)]
Detach block, freezer, and swap from resourced-light

Change-Id: I5c29e903a58c5d32c9f6a994388e39e335e0d864
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoMerge branch 'tizen_4.0' into tizen 79/157379/1
Kichan Kwon [Tue, 24 Oct 2017 07:06:12 +0000 (16:06 +0900)]
Merge branch 'tizen_4.0' into tizen

Change-Id: Ib26523597f897350c7817ab8c5559121983252d6
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agomemory : build resourced-config-tv package 04/156604/1 accepted/tizen/4.0/unified/20171020.014703 submit/tizen_4.0/20171019.080409 tizen_4.0.m2_release
Kichan Kwon [Thu, 19 Oct 2017 05:49:28 +0000 (14:49 +0900)]
memory : build resourced-config-tv package

- Configuration file for TV profile
- In current, TV profile disables memory compaction and memlimit

Change-Id: I3b86704b1cf055f0724d405843c1b03b5432c763
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agomm: compact: Add memory compaction module 76/155376/2 accepted/tizen/4.0/unified/20171019.081849 submit/tizen_4.0/20171018.094512
ByungSoo Kim [Mon, 21 Nov 2016 04:47:26 +0000 (13:47 +0900)]
mm: compact: Add memory compaction module

External fragmentation tracking module triggering
system-wide compaction case the fragmentation level
indicates possible failures of potential high-order
allocations.

Below are presented *rough* stats for similar workload
for both cases: compaction module being disabled and enabled.
Those are only to give a generic overview of potential benefits
of triggering memory compaction from user-space.
Note that those are based on kprobes and may have some
shortcomings.

Change-Id: Id4ec3a9ccd552eee02018a563746abd404029f35
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
[Rebase, fix svace issue]
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agocommon : check SMACK and privilege before running D-Bus signal handler 57/152057/8
Kichan Kwon [Fri, 15 Sep 2017 10:50:15 +0000 (19:50 +0900)]
common : check SMACK and privilege before running D-Bus signal handler

- To block malicious request
  - e.g. Send freezer signal for the app being in foreground
- In addition, modify the privilege for ProcSweep
  - Wearable home app has the code about sending this signal
  - Although it doesn't send currently, but if it send someday,
    we have to control with setting platform privilege

Change-Id: I7f260db24df31679514f00dbeb080e00979f42f9
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agomemory : consider sysinfo.mem_unit to get memory size 36/154936/4
Kichan Kwon [Wed, 11 Oct 2017 11:28:46 +0000 (20:28 +0900)]
memory : consider sysinfo.mem_unit to get memory size

- If (RAM + swap) size is larger than 4G, sysinfo.mem_unit
  is set to more than 1
- In this case, overflow can occur. So we have to use
  larger variable for storing memory size

Change-Id: Idf8e0ceade0596423a7d800e3db134391ced6ff0
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agomemory : remove setting memory limit for foreground app 05/154905/1
Kichan Kwon [Wed, 11 Oct 2017 11:07:28 +0000 (20:07 +0900)]
memory : remove setting memory limit for foreground app

- After vmpressure refactoring, foreground cgroup is removed

Change-Id: I3bb107bbe3f2ed8d348e4861773464eb9cd9edef
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoFix always true statement 71/152671/2 accepted/tizen/4.0/unified/20170927.181814 submit/tizen_4.0/20170927.011024 tizen_4.0.IoT.p1_release
Kichan Kwon [Wed, 27 Sep 2017 01:02:29 +0000 (10:02 +0900)]
Fix always true statement

Change-Id: Ia7ed847a5755109743f913065c035b7b7bb02830
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoFix minor issues 48/152448/3 submit/tizen_4.0/20170926.084635
Kichan Kwon [Tue, 26 Sep 2017 07:20:27 +0000 (16:20 +0900)]
Fix minor issues

- Prevent to access out of array
- Use larger constant for shifting more than 32
- Free before exit

Change-Id: I0297f8dca302148430332c521629ff0f14323536
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agocommon : check SMACK label before running D-Bus signal handler 12/150412/3
Kichan Kwon [Fri, 15 Sep 2017 10:50:15 +0000 (19:50 +0900)]
common : check SMACK label before running D-Bus signal handler

- To block malicious request
  - e.g. Send freezer signal for the app being in foreground
- In addition, modify the privilege for ProcSweep
  - Wearable home app has the code about sending this signal
  - Although it doesn't send currently, but if it send someday,
    we have to control with setting platform privilege

Change-Id: I7f260db24df31679514f00dbeb080e00979f42f9
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoSet the maximum input length 09/150709/1 accepted/tizen/4.0/unified/20170920.081626 submit/tizen_4.0/20170918.094512
Kichan Kwon [Mon, 18 Sep 2017 09:35:40 +0000 (18:35 +0900)]
Set the maximum input length

Change-Id: Id2f2ab716502e815636abc80e926e52ed2de21dd
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoDetach block module from resourced-light 21/147921/1 accepted/tizen/unified/20170907.060521 submit/tizen/20170906.065233
Kichan Kwon [Wed, 6 Sep 2017 05:19:31 +0000 (14:19 +0900)]
Detach block module from resourced-light

- Resourced-light will do only resource management

Change-Id: Icd1a5f006dda418fed6a586ce222292673c60f83
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agovip : restore vip-agent module 15/147915/1 accepted/tizen/4.0/unified/20170907.195935 submit/tizen_4.0/20170907.022036
Kichan Kwon [Wed, 6 Sep 2017 03:19:35 +0000 (12:19 +0900)]
vip : restore vip-agent module

- Faultd is excluded in Tizen 4.0
- In addition, apply ASLR with vip-release-agent

Change-Id: Ib636105377cef708621e6de72d8cc936960620f2
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoChange SMACK label to System 89/144989/3 accepted/tizen/4.0/unified/20170829.020402 accepted/tizen/unified/20170823.031728 submit/tizen/20170822.105330 submit/tizen_4.0/20170828.100004 submit/tizen_4.0/20170828.110004
Kichan Kwon [Mon, 21 Aug 2017 01:21:13 +0000 (10:21 +0900)]
Change SMACK label to System

- System::Privileged is used to modify SMACK label
- Resourced doesn't modify

Change-Id: Ice91ad826515d84648a2df1a8afcdf95ac757092
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoscripts : remove upgrade script 53/143453/4
Kichan Kwon [Thu, 10 Aug 2017 04:19:43 +0000 (13:19 +0900)]
scripts : remove upgrade script

- No more support 2.4 -> 3.0 upgrade

Change-Id: Ia2849ab3af17ca3561bb8d86ff493c34776e9f90
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoFix minor issues 24/142424/10
Kichan Kwon [Thu, 3 Aug 2017 09:29:03 +0000 (18:29 +0900)]
Fix minor issues

Change-Id: I9a02a8840542e319abcef63abbc2f8e61f113593
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoMerge "Heart: Fixed memory leak in heart_cpu_get_appusage_list()" into tizen
Kwon [Fri, 4 Aug 2017 08:04:27 +0000 (08:04 +0000)]
Merge "Heart: Fixed memory leak in heart_cpu_get_appusage_list()" into tizen

7 years agomemory: remove redundant operations 55/137655/11 submit/tizen/20170803.075349
ByungSoo Kim [Tue, 28 Mar 2017 05:56:18 +0000 (14:56 +0900)]
memory: remove redundant operations

Resourced will search all cgroup directories about systemd slice.
It is necessary to optimize the function lowmem_reassign_limit
by removing redundant codes.

Change-Id: Ica62829f18e4ade4394d88de7008c37ffcb4279b
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
7 years agomemory: follow kernel condition during chaning memory limit 54/137654/8
ByungSoo Kim [Thu, 16 Mar 2017 02:07:01 +0000 (11:07 +0900)]
memory: follow kernel condition during chaning memory limit

Kernel always compares new value with memswlimit.
So, if new value is smaller than memswlimit, memlimit should be set at first.
Otherwise, memswlimit should be set before setting memlimit.

++ mem_cgroup_resize_limit
if (memswlimit < val)
ret = -EINVAL;

++ mem_cgroup_resize_memsw_limit
if (memlimit > val)
ret = -EINVAL;

Change-Id: Ia0b848b0a2266f740f1c196cb7d089a80b77ec63
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
7 years agomemory : free old entry when memory limit is re-assigned 54/142254/1
Kichan Kwon [Thu, 3 Aug 2017 07:08:37 +0000 (16:08 +0900)]
memory : free old entry when memory limit is re-assigned

- Define destroy function to free automatically

Change-Id: Id3e511f7a794e99673a32857b67f7c149f780659
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agomemory: control memory limit in user space. 52/137652/10
ByungSoo Kim [Tue, 10 Jan 2017 11:13:50 +0000 (20:13 +0900)]
memory: control memory limit in user space.

Both kernel and system supported to register memory events for memcg.
But it had some problems that it can't check swap usage and notify which
application has a problem.

This patch introduces that all systemd services and desired applications
can register memory limit evenat with swap usage
and the resourced can kill a process which has a memory leak with a
popup and log files.
And all service application can't spend memory above 100MB.
Resourced will make crash popup for debugging in ENG binary or kill them
silently in USR binary.

Memory limit can support three kinds of configration.
1. threshold : resourced increases memory limit of kernel memcg.
    But instead, it registers threshold event.
    When kernel detects and notify threshold event,
    resourced finds a victim application and kills it with logs.
2. oom : If resourced can control the sysfs node of memcg oom_control,
    it can collect more debug informations when it exceeds memory limitation.
    Of course, it can be supported when only kernel allows to disable oom in user space.
    Otherwise, there is no difference between MEM_LIMIT_NONE and MEM_LIMIT_OOM.
3. other values : resourced registers the swap memory limit with normal memory limit.
    It doesn't register any memcg event.
    And it leaves everything about controlling memcg oom to kernel.

Change-Id: I6767183bb87964c8b5709503ee1288eaf6de5f42
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
[Rebase]
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoHeart: Fixed memory leak in heart_cpu_get_appusage_list() 00/140700/2
“JIBAN [Wed, 26 Jul 2017 06:06:19 +0000 (11:36 +0530)]
Heart: Fixed memory leak in heart_cpu_get_appusage_list()

[Model] COMMON
[BinType] AP
[Customer] OPEN

[Issue#] NA
[Request] NA
[Occurrence Version] NA

[Problem]  Memory Leak. app_lists was freed in error case
[Cause & Measure] Fixed memory leak
[Checking Method] NA

[Team] system framework
[Developer] Jiban Prakash
[Solution company] Samsung
[Change Type] Change

Change-Id: I3356bcd2517ea79dd7f60f0470658e8ee8244d50
Signed-off-by: “JIBAN <p.jiban@samsung.com>
7 years agocommon : explain why resourced doesn't use g_dbus_method_return_error 38/137438/7
Kichan Kwon [Thu, 6 Jul 2017 02:18:33 +0000 (11:18 +0900)]
common : explain why resourced doesn't use g_dbus_method_return_error

- cf) Process resource usage functions use return_error because
     it is only for Runtime-info (we can control this package)

Change-Id: Ia5ce23367ee4273eeca2b59c80096892fc1a6bb7
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoproc-stat : clarify process resource usage functions. 19/137219/7
Kichan Kwon [Mon, 3 Jul 2017 10:33:19 +0000 (19:33 +0900)]
proc-stat : clarify process resource usage functions.

- Specify reply signature
- Return error when it is failed

Change-Id: I960bfaadb2bbfc202adab516efb12d6ee9fc3212
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agomemory : set internal functions to static 76/138676/1 accepted/tizen/4.0/unified/20170816.011910 accepted/tizen/4.0/unified/20170816.015007 accepted/tizen/unified/20170717.021100 submit/tizen/20170713.073149 submit/tizen_4.0/20170811.094300 submit/tizen_4.0/20170814.115522 submit/tizen_4.0_unified/20170814.115522
Kichan Kwon [Thu, 13 Jul 2017 07:26:40 +0000 (16:26 +0900)]
memory : set internal functions to static

Change-Id: I18844ccd5275ca80dd162b09748b016ae755750d
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agovip : remove vip-agent module. 18/137218/3
Kichan Kwon [Wed, 5 Jul 2017 02:16:05 +0000 (11:16 +0900)]
vip : remove vip-agent module.

- Faultd will work this function

Change-Id: I5303d2353545c2cfae2e9d79bee8479b422d6676
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agomemory: reclaim memory when there is no high order buddy in kernel 56/131456/4
ByungSoo Kim [Wed, 26 Apr 2017 13:31:30 +0000 (22:31 +0900)]
memory: reclaim memory when there is no high order buddy in kernel

Even though there is enough memory, kswapd uses much cpu
when there is no high order buddy.
We have already triggered memory compaction.
But, if many background applications are running,
kernel can't reduce fragmentation.
The best method for reducing kernel fragmentation is
to run proactive LMK in resourced.

For example, when automatic test tool launched many applications continuously,
there were so many background applications over 24 numbers
and we could observe kswapd always used 5% cpu in order to reclaim memory
until available memory was not enough in medium threshold.

Therefore it is necessary to check buddy info and start proactive LMK.
It has been already applied in low memory device and we got better result.
Moreover, it will be better in even high memory device also.

Change-Id: Ibb888a73e2185c35aae3025e2a8e210885acfaae
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoproc: add /proc/buddyinfo parse api 54/131454/2
ByungSoo Kim [Wed, 26 Apr 2017 13:26:20 +0000 (22:26 +0900)]
proc: add /proc/buddyinfo parse api

Resourced needs to know current buddy information.
When there is no high order buddy in kernel,
it makes sluggish issue due to high cpu consumption of kswapd.

Change-Id: I173e5d4e43a842be713788372d55feb61ce65cf6
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
7 years agomemory : don't clear logs when the directory path is too long 83/133883/4
Kichan Kwon [Wed, 14 Jun 2017 01:15:37 +0000 (10:15 +0900)]
memory : don't clear logs when the directory path is too long

Change-Id: Iabed7123bdf03cabc381ed16f0a0b983fb627090
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
7 years agoUse the string copy function having maximum limit 24/132824/2 accepted/tizen/unified/20170608.185103 submit/tizen/20170608.101022
Kichan Kwon [Thu, 8 Jun 2017 02:00:25 +0000 (11:00 +0900)]
Use the string copy function having maximum limit

- To prevent from making non-terminated string
- strcpy -> strncpy
- sprintf -> snprintf

Change-Id: I0c01ff4e25bceb943c3ade45f9fa5bacd6c9209b
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>