Ł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>
Ł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
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
Ł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>
Ł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>
Ł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>
Ł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>
Łukasz Stelmach [Thu, 24 May 2018 12:49:59 +0000 (12:49 +0000)]
Merge "Bump version of the resourced-light package" into tizen
Ł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>
Karol Lewandowski [Wed, 23 May 2018 14:39:53 +0000 (14:39 +0000)]
Merge "Enable swap module in resourced-light" into tizen
Ł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>
Ł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>
Ł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>
Mateusz Moscicki [Mon, 16 Apr 2018 09:11:32 +0000 (11:11 +0200)]
Enable swap module in resourced-light
Change-Id: I2e191cf69449950a953273e116cb0e44caaf2230
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
Karol Lewandowski [Thu, 17 May 2018 13:16:00 +0000 (13:16 +0000)]
Merge "Build resourced-light with a separate spec" into tizen
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>
Ł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>
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>
Ł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
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>
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>
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>
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>
Ł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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>
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>
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>
“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>
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>
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>
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>
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>
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>
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>
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>
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>
Kichan Kwon [Wed, 7 Jun 2017 02:47:50 +0000 (11:47 +0900)]
Limit the maximum input string length of sscanf
- If there is no limit, sscanf can write the out of array's bound
- To make format specifier setting limit to macro, define STR_FS(macro)
Change-Id: I800112b37386192708db26f0b009f3a40a5fbb07
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kichan Kwon [Thu, 25 May 2017 08:11:20 +0000 (17:11 +0900)]
Open proc D-Bus methods for non-root having systemmonitor privilege
Change-Id: I527e37b4778be9d45a1ade41423dcb24ac68e41f
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kunhoon Baik [Wed, 24 May 2017 23:54:59 +0000 (08:54 +0900)]
Clean up unneceassry build dependency
Change-Id: Iaff85867cb0d5887de1335b5eb031f100b23907a
Kunhoon Baik [Wed, 24 May 2017 12:45:00 +0000 (21:45 +0900)]
Heart: Remove the mechanism which removes logging-data from Heart DB by explict data-query
In Tizen 3.0 and Early Tizen 4.0, we observed whether there are some requirements for deleting logging-data explictly.
Meanwhile, the logging functions like logging_get_latest_in_cache,logging_read_foreach has been used for several purposes.
However, there are some bugs that the logging functions do not consider such deleting data cache entries in module cache.
Thus, our plan was to improve the functions if there are some requirement for deleting logging-data explictly.
However, there are no requirements about it.
Thus, finally, we decided to remove the explict logging-data removing mechanism because there are no use cases.
Thus, from now, data of heart DBs will be removed according to just impliict(internal) rule.
That is, in this time, the old data is removed automatically when the DB size limit is reached.
Change-Id: Ief4cf1baa595030fddd6becd929165ee4857e8bb
Kichan Kwon [Wed, 24 May 2017 09:23:16 +0000 (18:23 +0900)]
swap : remove const at module_ops variable
- .initalized will be modified
Change-Id: I21626a1c5732dc156978007024a64ceb3a0127ec
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kichan Kwon [Wed, 24 May 2017 00:44:38 +0000 (09:44 +0900)]
heart : delete after collecting candidates to prevent deadlock
- Both read_foreach and logging_delete locks cache mutex
- Therefore, logging_delete should be called after read_foreach
is ended
Change-Id: I4a34fc4a26bc27e1739f1cfa4ce7331ed1fcab3b
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
ByungSoo Kim [Tue, 2 May 2017 11:53:40 +0000 (20:53 +0900)]
proc: get approximate memory usage from /proc/{pid}/statm
Considering RSS and Shared of statm is more accurate than using the ratio for RSS.
And, there are many apis for getting memory usage in procfs.
Of course, resourced should know all kinds of memory information
depending on the situations.
For instance, when LMK predicts secured memory usage after killing victims,
it should check real ram usage which considers zram compression ratio.
On the other hand, if someone wants to know memory usage,
it can check approximate memory usage from /proc/{pid}/statm
and swap usage from /proc/{pid}/status.
Conflicts:
src/memory/lowmem-limit.c
Change-Id: I7e664ff40f05fa9c1d8122be64180e5e7a8fab77
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
ByungSoo Kim [Wed, 26 Apr 2017 13:10:30 +0000 (22:10 +0900)]
memory: trigger proactive oom killer based on heart memory
We haven't yet enabled history based proactive LMK
because heart memory makes an overhead.
But, previous patches as well as this reduced an overhead and simplied.
Now, we can check average memory usage and trigger proactive LMK
when application is launched.
Conflicts:
src/memory/vmpressure-lowmem-handler.c
Change-Id: Id83ca0b3517d6ae73ee1a8713096cfae8516a254
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
ByungSoo Kim [Wed, 26 Apr 2017 13:06:26 +0000 (22:06 +0900)]
heart: calculate memory usage of child processes if it is available
Many applications have child processes when they are groupped together
for instance browser.
If resourced logs exact memory usage, it has to check child processes too.
Change-Id: I1ecae490d679de1d8ef0d1bb26796d2ea3874e33
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
ByungSoo Kim [Tue, 25 Apr 2017 11:37:16 +0000 (20:37 +0900)]
heart: remove decision memory in heart-memory
We haven't ever enabled both heart-memory and decision-memory.
Further, heart-memory will support accumulated application memory usages
and other modules or services can reference this information.
However, decision memory based on heart isn't still unstable
because we can't decide whether some application is malicious or not
how much memory it uses.
Of course, if we collect more information and check others such as LMK pattern,
we can enable decision memory again.
But not now.
Change-Id: I7b7c80dfc5218823cf05ff2e80a0c327bfad28d6
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
ByungSoo Kim [Tue, 25 Apr 2017 11:30:43 +0000 (20:30 +0900)]
heart: simplify heart memory module
Getting USS and PSS from smaps of each application is big overhead
whenever application goes to the background state.
It is enough to check RSS of application in order to provide application memory usage.
Conflicts:
src/heart/heart-memory.c
Change-Id: Ie50c00910f20da522a49f1fc3ebf31f5b5647c99
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Kunhoon Baik [Mon, 22 May 2017 09:56:25 +0000 (18:56 +0900)]
Preparation to providing process memory information at OOM situation
The memory information log may be useful when some process is killed in high memory pressure.
However, we did not yet decide when the information is provided.
This patch is just preparation for such purpose.
Note : This functionality is originated from Mr.ByungSoo Kim.
Change-Id: Id1b3a7d2cebd07ac00548cc80f9e27061c738bfe
ByungSoo Kim [Tue, 18 Apr 2017 11:18:57 +0000 (20:18 +0900)]
memory: make generic api for getting rss
Other modules also need to get RSS
because it is faster than checking smaps.
Change-Id: I4af8207cf57ae47c8ba66177770a012a02d6566a
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
ByungSoo Kim [Mon, 9 Jan 2017 04:52:09 +0000 (13:52 +0900)]
memory: don't search smaps for calculating uss
In oom situation, it needs to kill victim applciations as soon as
possible.
However, searching smaps for getting uss value takes a long time about
50 ~ 100ms per application.
It is not necessary for lowmem handler to check memory status.
But instead, RSS is not exact value about real memory usage even though
it is fast to get.
So heuristic weight factors should be considered.
Conflicts:
src/memory/vmpressure-lowmem-handler.c
Change-Id: I8381094afc3ba6420068c0adff82280e67031931
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Kichan Kwon [Mon, 22 May 2017 07:13:12 +0000 (16:13 +0900)]
Fix memory issues
Change-Id: I9313053711593b4a202b018f83827042aa676b65
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kwon [Mon, 22 May 2017 07:13:28 +0000 (07:13 +0000)]
Revert "Version up"
This reverts commit
6a7ef2e939783b1c8197fada0e96ec63a942e585.
Change-Id: I1ac024fec44f234144156c442ee7719154f6b344
Kichan Kwon [Mon, 22 May 2017 06:41:54 +0000 (15:41 +0900)]
Version up
Change-Id: Ia7d1c31402c049937e5b32f042edb9ac11091a3a
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
ByungSoo Kim [Mon, 9 Jan 2017 08:08:40 +0000 (17:08 +0900)]
common: flush cache memory
Flush resourced memory such as other processes.
Resourced can use both many fast bins and sqlite3 cache memery.
It can be increased over 10MB while running applications continuously for a long time.
Change-Id: If59758ccd81f6a9c656760fc800e8f88c1403832
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
ByungSoo Kim [Wed, 5 Apr 2017 12:57:05 +0000 (21:57 +0900)]
proc: don't increase reference count of app-info
The function proc_create_app_info can be called multiple times.
If it increases reference count of app-info continuously,
app-info is never released after application has been already terminated.
Change-Id: I614c7526e228ceb260d7f0b7c95888288b237ecb
ByungSoo Kim [Tue, 21 Feb 2017 05:18:17 +0000 (14:18 +0900)]
proc: increase default oom score about widget applications
Most widget applications are prelaunched while booting.
But if user can't select them, oom score is not changed.
When resourced meets the out of memory situation,
it is hard to select widget applications to victims.
Change-Id: Iecac6181ba7973355128c557085e476c6f8e72d0
Signed-off-by: ByungSoo Kim <bs1770.kim@samsung.com>
Kunhoon Baik [Sat, 20 May 2017 04:52:11 +0000 (13:52 +0900)]
Clean up remained Dbus-1 related codes
Clean up codes, makefile and specfile to remove dbus-1 dependency
Change-Id: Idd75e3395fff79697010b49ac418d41967a898c7
Kunhoon Baik [Fri, 19 May 2017 10:50:32 +0000 (19:50 +0900)]
Bug Fix to original behavior
During migration to gdbus, there are some bugs changing communication behaviors.
This patch fixes such bugs
In addition, following issues also are solved.
a) variable uninitilization for checking dbus param error
b) memory leak
Change-Id: I1f89cf761fced330cb90a24e823d31f0a68d74b5
Kichan Kwon [Fri, 19 May 2017 09:35:08 +0000 (18:35 +0900)]
Fix gdbus related issues
- Modify return argument type
- Fix method table overlapping
- Add missing return argument type
Change-Id: I10958b275c05f81b8f23fd3ca44fb6485f884b75
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kichan Kwon [Fri, 19 May 2017 06:06:49 +0000 (15:06 +0900)]
Fix memory issues
Change-Id: Ic8cc351686234e39937c9e972c351385b46bd665
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kichan Kwon [Fri, 19 May 2017 07:00:08 +0000 (16:00 +0900)]
heart : remove pipe and fd handler for SyncCpuData
- Main thread has replied message because libdbus is not thread-safe
- However, we are using gdbus, so other thread can reply directly
Change-Id: I06325194791203d9c917047e873330f4fad51650
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kichan Kwon [Tue, 25 Apr 2017 06:51:50 +0000 (15:51 +0900)]
memory : remove dynamic oom threshold
- It is introduced to prevent killing foreground app frequently
- But now, it isn't handled; this value is always fixed.
- What's more, resourced has been improved that it doesn't kill
foreground app frequently
Change-Id: I8d1affb409030cb1a1d4f07ac2a8abceb32dc123
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kichan Kwon [Wed, 29 Mar 2017 09:47:18 +0000 (18:47 +0900)]
Arrange exclude list
- Remove not used app in Public Tizen
- Use org.tizen.XXX instead of com.samsung.XXX
Change-Id: I97a38fb07d726c440bc60583c4200a293875dc25
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kichan Kwon [Tue, 28 Mar 2017 08:52:17 +0000 (17:52 +0900)]
heart : flush and print data when charging is started
- Flush condition : cap(last_charge_is_ended) - cap(cur) > 10
Change-Id: I11ab67f16abeca8bc9d326bf1b5cc581b4d88157
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kichan Kwon [Tue, 28 Mar 2017 02:32:56 +0000 (11:32 +0900)]
heart : use root's pid for logging instead of process'
Change-Id: I536a50eb6b3cfce05fc84bd78d7ccaaededa527b
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kichan Kwon [Mon, 27 Mar 2017 08:46:21 +0000 (17:46 +0900)]
proc-stat : no more use cleanup macro if the function can be ended before opening proc_app_list
- cleanup_app_list_close macro decreases reference counter
- Therefore, this macro should be called after proc_app_list is opened
- In this case, we will not use this macro
Change-Id: I66a074523543e9791c61a718e1530836189f9714
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
Kichan Kwon [Mon, 27 Mar 2017 07:41:02 +0000 (16:41 +0900)]
proc-stat : record app's starttime and use it for getting cpu usage
- In previous approach, starttime is gotten from /proc/{pid}/stat
- But, this value can't guarantee time delta with current uptime
- In case of multicore environment
- Therefore, we will use the uptime when app is launched
- To use uptime to starttime, we will store this time
Change-Id: I86dab9bc261012686a1e92ed7c2b2bd3fdf5be47
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>