summaryrefslogtreecommitdiffstats
path: root/libprocessgroup
Commit message (Collapse)AuthorAgeFilesLines
* Switch fastboot/init/libprocessgroup to std::this_thread::sleep_for.Elliott Hughes2016-11-141-1/+4
| | | | | | Bug: http://b/32878766 Test: boots Change-Id: Ie0ddfb7e60f2da5f6eefbb10c83a92e88c137ae3
* Use readdir instead of readdir_r.Elliott Hughes2016-09-281-6/+4
| | | | | | | http://elliotth.blogspot.com/2012/10/how-not-to-use-readdirr3.html Test: boots. Change-Id: If75532e24fe4d17743bf8e8c9590156dee378a63
* resolve merge conflicts of ed3596a to stage-aosp-masterElliott Hughes2016-08-032-58/+44
|\ | | | | | | Change-Id: I3c41782e2bf3563d3e3d6232d39eff3da94843fc
| * Switch libprocessgroup to libbase logging.Elliott Hughes2016-08-032-57/+43
| | | | | | | | | | | | | | | | This lets us see what's going on in init. Bug: http://b/29751426 Merged-In: I73432dc7608ca0dc8e421a2f3a750b37c6743f62 Change-Id: I73432dc7608ca0dc8e421a2f3a750b37c6743f62
* | resolve merge conflicts of cea1d04 to nyc-dev-plus-aospElliott Hughes2016-06-062-14/+23
|\| | | | | | | Change-Id: I41cdca717664a16f00fd1b28076dd752fa96653d
| * use process groups for processes started by initCollin Mulliner2016-06-062-13/+22
| | | | | | | | | | | | | | | | | | | | Put every service into a process group, kill the process group and all child processes created within the group when killing the service. Removed libutil dependency in libprocessgroup. Bug: 25355957 Change-Id: Ieed60ec41579f638ab9b1e66a7e6330ed578ab05 Signed-off-by: Collin Mulliner <collinrm@squareup.com>
| * Remove useless #include.Elliott Hughes2016-04-301-1/+0
| | | | | | | | | | Bug: http://b/28432688 Change-Id: I8982f42b2bf2305168a4ba167e422173f35c69c2
* | Merge "Don\'t use mem cgroups for pid accounting." into nyc-devMartijn Coenen2016-03-181-0/+7
|\ \ | | | | | | | | | | | | | | | | | | am: e9ea8db * commit 'e9ea8db617f52ddaa51e3b6fb9663e2f9b069425': Don't use mem cgroups for pid accounting.
| * | Don't use mem cgroups for pid accounting.Martijn Coenen2016-03-181-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit b82bab66 introduced the use of memory cgroups for keeping track of forked PIDs; it basically creates a separate memory cgroup for every process forked from zygote. Each such memory cgroup which also have its own LRU with (in)active file and anonymous pages. The current theory is this could potentially introduce two problems: 1) kswapd runs longer because it has to iterate over the LRUs of all mem cgroups, instead of over the LRUs of a single root mem cgroup; 2) the way kswapd reclaims things will be different also - I think it will tend to bias reclaim to smaller mem cgroups, and process private pages will end up on ZRAM swap much sooner. Until we figure this out, fall back to the CPU accounting cgroup for keeping track of forked PIDs. This leaves us with a single root mem cgroup again. We can also keep userspace lmkd enabled because it only requires the root mem cgroup. Bug: 27381069 Change-Id: Ife397a6ac232761f2adfe6f5056582be0d1b4ff1
* | | resolve merge conflicts of 0f5d443d0c to nyc-dev-plus-aospJames Hawkins2016-02-191-6/+5
|\ \ \ | |/ / |/| / | |/ Change-Id: I850bda0808ae17ade5bc0e667211a599d284d6e3
| * system/core: Cleanup direct calls to opendir by containing in aJames Hawkins2016-02-181-6/+5
| | | | | | | | | | | | | | std::unique_ptr. Bug: 26643633 Change-Id: Ia3491fdbff086558da694ae949cf08e4c89d0307
* | Fix libprocessgroup SELinux denials.Martijn Coenen2016-02-081-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libprocessgroup checks whether it can use memory cgroups for keeping track of forked processes by seeing whether /dev/memcg/apps is writable. However, on systems with memory cgroups disabled, SELinux (correctly) no longer classifies this directory as a cgroup, and starts denying zygote access. To fix this, first check whether /dev/memcg/apps/tasks exists to see if the cgroup is mounted; only then check whether we can write to the directory. Bug: 27046965 Change-Id: I6e44cd62d8c396e20ceb162c50606b3e86f2cb3e
* | Reuse mem cgroups for tracking forked PIDs.Martijn Coenen2016-02-014-82/+35
|/ | | | | | | | | | | | | | | | | | | It turns out we were using the CPU accounting cgroups for keeping track of processes that were forked by an app without the framework's knowledge, so we could kill all of them reliably (see b/15313911 for context). Since we want to use memory cgroups for other purposes, we might as well use memory cgroups for tracking forked PIDs if they're enabled. This also gets us automatic cleanup of empty mem cgroups. Also, removed old mem cgroup mount point that is no longer used, as well as cgroup release agent code that we're not using. Change-Id: I69d5cc31c162ffa49ef6945755f41381e306cc8b
* processgroup: change the polling interval for killProcessGroup()Yusuke Sato2015-06-161-3/+4
| | | | | | | | | | to make the function faster on average. Since killing a process takes about 40-60ms on a recent device, the previous logic tends to sleep too long. This CL does not significantly change the total timeout (old code: 204ms, new code: 200ms). Bug: 21813611 Change-Id: Ica44b2437ccccaebadcf585d7a09d993ce71a499
* Remove uses of libcxx.mk.Dan Albert2015-03-271-1/+0
| | | | | | This is a no-op. Change-Id: Iecbcd5f6d818abbf98767a2e996c10f454b652e4
* Fix missing #includes in system/core.Elliott Hughes2014-12-291-0/+1
| | | | Change-Id: I4736e8c4f7bb8bb03640d26d58243efaa67dc75c
* Fix format stringChih-Hung Hsieh2014-11-201-3/+4
| | | | | | | Make a format string match the type of the parameter it represents Change-Id: I0af88636448084b56450996ea9dafdba3c1fd2a3 Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org
* Make mkdirAndChown do what it claims to doBernhard Rosenkränzer2014-11-171-2/+2
| | | | | | | | | | | | | Currently, mkdirAndChown takes parameters for mode, uid and gid, but ignores them and hardcodes 0750, AID_SYSTEM, AID_SYSTEM instead. This doesn't matter much because so far its only invocation passes exactly those values as parameters -- but clang complains about unused parameters. Might as well make the function do what it claims to do. Change-Id: I5a8056be3278a0c5d0a576dbc061288aa0956a35 Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
* Fix issue #18000467: processgroup truncates bufferDianne Hackborn2014-10-151-1/+1
| | | | Change-Id: I3d98a4da9c47d83d25a11ff0ef94cfcab1feabea
* Maybe fix issue #17969789: Shamu FR: Runtime restart while scrolling InstagramDianne Hackborn2014-10-132-5/+29
| | | | | | | | | | | | | | | | | It looks like there were a couple problems in the code: - It would not 0-terminate the string it read, to make sure we didn't see garbage at the end. - It didn't reduce buf_len as it processes data in the buffer, so if we need to read more we will increase the buffer length to be longer than the actual available data. Also put in some logs about every thing we kill, so we can see what is going on when debugging. And add a special check for us trying to kill pid 0 for any reason, since doing so seem to be terminal to the caller. Change-Id: I2fe29bfef08938b8a2eb182475c0705c14d8d84f
* processgroup: close directories opened by removeAllProcessGroups()Colin Cross2014-08-201-2/+3
| | | | | | | | | removeAllProcessGroups and removeUidProcessGroups were calling opendir, but never called closedir. This would leave a leaked file descriptor for every /acct/uid_* directory that existed at boot. Change-Id: Ia08eccd42d6ad7a6c1c78402519ac2e53b4fc83a
* Add libprocessgroupColin Cross2014-07-095-0/+436
libprocessgroup will allow Zygote to place processes in a cgroup, and then kill the process and all forked processes later. lmkd will also kill all forked processes. Bug: 15313911 Change-Id: I20404d0dbe448f1c475d2f4c61cccca462f9e544