• Home
  • History
  • Annotate
  • only in /system/core/libprocessgroup/
History log of /system/core/libprocessgroup/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
cbb690299f5910aa9b9162e151f0e54d1de73d7b 23-May-2018 Suren Baghdasaryan <surenb@google.com> Make per-application memcg hierarchy configurable via a property

Introduce ro.config.per_app_memcg Android property to enable/disable
per-application memcg hierarchy.
On low-ram devices (ro.config.low_ram=true) ro.config.per_app_memcg
defaults to true, otherwise it defaults to false.

Bug: 80201565
Test: set ro.config.per_app_memcg=true and verify /proc/<app_pid>/cgroup
membership (memory:/apps/uid_xxx/pid_xxx)
Test: set ro.config.per_app_memcg=false and verify /proc/<app_pid>/cgroup
membership (memory:/)
Change-Id: Iabd3ef6c9c16c774b9da959a7f43b5f66df120a3
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
rocessgroup.cpp
574a0816238748be8cbd35cf1009a8ebced6e75b 23-Feb-2018 Tom Cherry <tomcherry@google.com> libprocessgroup: remove legacy C string handling and build for host

Bug: 36970783
Test: kill zygote and see that its children die correctly
Change-Id: I1b0e9a9cdb834a000fec82323d690e3bd288692d
ndroid.bp
rocessgroup.cpp
d485226951013247dbb502fef7edbc6cf83acb0f 17-Jul-2017 Robert Benea <robenea@google.com> Add memcg related configs to init.

Allow configuring memory.swappiness, memory.soft_limit_in_bytes
and memory.limit_in_bytes by init; by doing so there is better
control of memory consumption per native app.

Test: tested on gobo branch.
bug: 63765067
Change-Id: I8906f3ff5ef77f75a0f4cdfbf9d424a579ed52bb
nclude/processgroup/processgroup.h
rocessgroup.cpp
3280e48847e5dd16521ad7040d53eb30b66bf740 28-Jun-2017 Robert Benea <robenea@google.com> Use mem cgroups in libprocessgroup if they're available

Use mem cgroups if the kernel is built with CONFIG_MEMCG=y,
additionally add system group.

test: verified on both kernel with/without memcg enabled
Change-Id: Ia2ae89efa3905e9da68fa77adac1225c667864d1
rocessgroup.cpp
fc10e3d5e5385081853b7d1b3cc41f882ac6325d 08-Jul-2017 Tim Murray <timmurray@google.com> Revert "Use mem cgroups in libprocessgroup if they're available"

This reverts commit 32375c23284704a7d044ed79060c4431468b4b4e.

bug 63164307

Change-Id: I3336bbf7c2f3297b231c5b0a1ef538faff9513fd
rocessgroup.cpp
32375c23284704a7d044ed79060c4431468b4b4e 28-Jun-2017 Robert Benea <robenea@google.com> Use mem cgroups in libprocessgroup if they're available

Use mem cgroups if the kernel is built with CONFIG_MEMCG=y,
additionally add system group.

test: verified on both kernel with/without memcg enabled
Change-Id: Ib9d1c8e3c797e75f160e0e92edf3f11c9d8e9f17
rocessgroup.cpp
70a5ed49ef82d0d87508080563ec10b994bf4f9e 06-Jun-2017 Tom Cherry <tomcherry@google.com> init: move killing of process groups to libprocessgroup

libprocessgroup kills the cgroup associated with a given pid and uid,
but not the POSIX process group associated with it. This means that
to kill both, two of the same signals must be sent, which may cause
some issues.

This change kills all POSIX process groups whose group leaders are
found within a cgroup. It only then kills processes in the cgroup
that are not part of the POSIX process groups that have been killed.

Bug: 37853905
Bug: 62418791
Test: Boot, kill zygote, reboot
Change-Id: Id1d96935745899b4c454c36c351ec16a0b1d3827
rocessgroup.cpp
efa81080fda2591bcc7411053c7a560ff32df1b7 10-May-2017 Tom Cherry <tomcherry@google.com> Enable libprocessgroup on host bionic

Bug: 31559095

Test: Build
Change-Id: I1ee9fb492137c6c16f0d02586393837616127972
ndroid.bp
20514c4411923e03df4a5057ef43bf9716983e14 21-Apr-2017 Tom Cherry <tomcherry@google.com> Better logging in libprocessgroup and make resources clean up themselves

Bug: 36661364
Bug: 36701253
Bug: 37540956

Test: Reboot bullhead
Test: Start and stop services
Change-Id: I97b6e17a7350850db733bee9fc83bdd296d88c61
nclude/processgroup/processgroup.h
rocessgroup.cpp
419ce36c7d3911002e8cbabffe5e8addc1388a0c 19-Apr-2017 Steven Moreland <smoreland@google.com> libprocessgroup: Android.mk -> Android.bp

Test: links
Test: (sanity) boot marlin in recovery + to system UI
Bug: 37512442
Change-Id: Ie19c02bda9df7c0cfdeeaf34c48f251b2b93961d
ndroid.bp
ndroid.mk
fac4b63effee6c69908f559fd5e260bc95f1893a 29-Mar-2017 Keun-young Park <keunyoung@google.com> add killProcessGroupOnce

- killProcessGroup retries if it fails while
killProcessGroupOnce only tries once.
- useful for sending signal like SIGTERM once.

bug: 36696408
Test: will add usage to init
Change-Id: Ia1e3d4ec848e785a3238f262b02914695cded4c7
nclude/processgroup/processgroup.h
rocessgroup.cpp
290a228fdca935ab2e702db77516758314900c3a 15-Nov-2016 Elliott Hughes <enh@google.com> Switch fastboot/init/libprocessgroup to std::this_thread::sleep_for.

Bug: http://b/32878766
Test: boots
Change-Id: Ie0ddfb7e60f2da5f6eefbb10c83a92e88c137ae3
rocessgroup.cpp
9f206938edc2243e4e4f5de74d67e15befd95576 28-Sep-2016 Elliott Hughes <enh@google.com> Use readdir instead of readdir_r.

http://elliotth.blogspot.com/2012/10/how-not-to-use-readdirr3.html

Test: boots.
Change-Id: If75532e24fe4d17743bf8e8c9590156dee378a63
rocessgroup.cpp
b6e1d15056f2a9c136a640336d78d36ab58a719d 03-Aug-2016 Elliott Hughes <enh@google.com> resolve merge conflicts of ed3596a to stage-aosp-master

Change-Id: I3c41782e2bf3563d3e3d6232d39eff3da94843fc
171df0a092157deb2cdf868beecc2ca3dcbeb548 02-Aug-2016 Elliott Hughes <enh@google.com> Switch libprocessgroup to libbase logging.

This lets us see what's going on in init.

Bug: http://b/29751426
Merged-In: I73432dc7608ca0dc8e421a2f3a750b37c6743f62
Change-Id: I73432dc7608ca0dc8e421a2f3a750b37c6743f62
ndroid.mk
rocessgroup.cpp
8d532e47376859e2ea8f953ebe75d24560e80464 07-Jun-2016 Elliott Hughes <enh@google.com> resolve merge conflicts of cea1d04 to nyc-dev-plus-aosp

Change-Id: I41cdca717664a16f00fd1b28076dd752fa96653d
f7e79b99c1e9e3128dd9921871f7740bebb755e6 01-Jun-2016 Collin Mulliner <collinrm@squareup.com> use process groups for processes started by init

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>
ndroid.mk
rocessgroup.cpp
c4248ae9a1a3a59d5ef5838a850d7e7898dbe52e 30-Apr-2016 Elliott Hughes <enh@google.com> Remove useless #include.

Bug: http://b/28432688
Change-Id: I8982f42b2bf2305168a4ba167e422173f35c69c2
leanup.cpp
d89cd41bc7f3515133e18231e8f84065f1a9a133 18-Mar-2016 Martijn Coenen <maco@google.com> Merge "Don\'t use mem cgroups for pid accounting." into nyc-dev
am: e9ea8db

* commit 'e9ea8db617f52ddaa51e3b6fb9663e2f9b069425':
Don't use mem cgroups for pid accounting.
5bb91ab5530dd002f6021b2177dc2bcf5467eebd 18-Mar-2016 Martijn Coenen <maco@google.com> Don't use mem cgroups for pid accounting.

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
rocessgroup.cpp
22b6f7a559e02f44442a1f5079d790884971d7f2 19-Feb-2016 James Hawkins <jhawkins@google.com> resolve merge conflicts of 0f5d443d0c to nyc-dev-plus-aosp

Change-Id: I850bda0808ae17ade5bc0e667211a599d284d6e3
588a2cad7faee54bfb16050d0c7398709f304fea 18-Feb-2016 James Hawkins <jhawkins@google.com> system/core: Cleanup direct calls to opendir by containing in a
std::unique_ptr.

Bug: 26643633
Change-Id: Ia3491fdbff086558da694ae949cf08e4c89d0307
rocessgroup.cpp
623b56af5da59fb57abcb2d984762669c82f57e9 08-Feb-2016 Martijn Coenen <maco@google.com> Fix libprocessgroup SELinux denials.

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
rocessgroup.cpp
b82bab66f318896ebad80c1feee2347c58e3ce37 21-Jan-2016 Martijn Coenen <maco@google.com> Reuse mem cgroups for tracking forked PIDs.

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
ndroid.mk
leanup.cpp
rocessgroup.cpp
rocessgroup_priv.h
d50393057a6551c3bb498ed3a3bb7bd9eeb48225 16-Jun-2015 Yusuke Sato <yusukes@google.com> processgroup: change the polling interval for killProcessGroup()

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
rocessgroup.cpp
d0a793dca3c208ab04b67cd7dc0126a3d394d8dd 27-Mar-2015 Dan Albert <danalbert@google.com> Remove uses of libcxx.mk.

This is a no-op.

Change-Id: Iecbcd5f6d818abbf98767a2e996c10f454b652e4
ndroid.mk
0badbd6565fea17be39d82eba858fa76d28920a4 29-Dec-2014 Elliott Hughes <enh@google.com> Fix missing #includes in system/core.

Change-Id: I4736e8c4f7bb8bb03640d26d58243efaa67dc75c
rocessgroup.cpp
fcc8115dcf33b547facab9c6f2f4739f85ab69c1 21-Nov-2014 Chih-Hung Hsieh <chh@google.com> Fix format string

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
rocessgroup.cpp
758aeb7dadfcd29b11e8648d784ea56f31be05f3 17-Nov-2014 Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> Make mkdirAndChown do what it claims to do

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>
rocessgroup.cpp
67f46cb0e137edbf4a6f7014ca8a3a58484016d1 15-Oct-2014 Dianne Hackborn <hackbod@google.com> Fix issue #18000467: processgroup truncates buffer

Change-Id: I3d98a4da9c47d83d25a11ff0ef94cfcab1feabea
rocessgroup.cpp
2c5e7e102bc2059d22f8457db68c567b64cec963 14-Oct-2014 Dianne Hackborn <hackbod@google.com> Maybe fix issue #17969789: Shamu FR: Runtime restart while scrolling Instagram

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
ndroid.mk
rocessgroup.cpp
c15dd044705aa86f63b2642c1439d5f943a80d18 20-Aug-2014 Colin Cross <ccross@android.com> processgroup: close directories opened by removeAllProcessGroups()

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
rocessgroup.cpp
cf8d1c22f7e239f502a7d209e2255d2997dbeb8b 03-Jun-2014 Colin Cross <ccross@android.com> Add libprocessgroup

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
ndroid.mk
leanup.cpp
nclude/processgroup/processgroup.h
rocessgroup.cpp
rocessgroup_priv.h