summaryrefslogtreecommitdiffstats
path: root/libcutils/sched_policy.c
Commit message (Collapse)AuthorAgeFilesLines
* sched_policy: zero proc_name buffer before populatingScott Mertz2016-03-301-0/+1
| | | | | | | | The process name will be read into the buffer containing the proc name filepath. We need to reinitialize the buffer before reading into it. Change-Id: I67710819c895d3f9e2b0d486ab8a11f29f8318e8
* sched_policy: split add_tid_to_cgroupPat Erley2016-03-241-11/+38
| | | | | | | | | add_tid_to_cgroup was also being used to add threads to cpusets. Split this into a generic write_tid_to_fd, and wrap it for cpusets and cgroups. This lets errors align with what the actual failure is. Change-Id: I2c5c97117428a33b6a328f73741d3516d4141f78
* sched_policy: Split cpuset/cgroup initPat Erley2016-03-241-3/+18
| | | | | | | | If a task only ever touches cgroups, don't initialize cpusets. This makes logging fails for cpusets much less spammy. Change-Id: Iad9c58db68ecd2c2445255bfe5564318064949a5
* libcutils: Add process name to logsPat Erley2016-03-241-10/+22
| | | | | | | This can help resolve permissions issues for tasks that want to twiddle the perf bits but don't have permissions. Change-Id: I6285c5c38224d1fb207cb26229cd7b779a8322ac
* libcutils: make sched_policy more robustPat Erley2016-03-181-1/+45
| | | | | | | | If you compile with cpusets enabled but the permissions are wrong the behavior becomes no real policy enforced at all. Fix this by making sched_policy fall back gracefully. Change-Id: Ife96ca64b991e23232a5bd0d6c21e30a5d16bde8
* Fix logspam from system-background cpuset.Tim Murray2015-12-171-3/+0
| | | | | | | | | | | system-background can't be opened by most processes, since system-bg is a privileged cpuset. Remove the log message when it can't be opened. We'll still log a failure to use the fd if we try to use it after it can't be opened, which is fine. bug 26249842 Change-Id: I99f185c51645bc81b6a41732848227c27675cdf7
* Improve cpuset support for surfaceflinger.Tim Murray2015-11-181-0/+9
| | | | | | | | | | | | | SurfaceFlinger needs some of its threads in the system-background cpuset and some of its threads (the binder pool) outside of the system-background cpuset in order to improve UI perf/power consumption. Remove surfaceflinger from the system-background cpuset in init.rc and allow a thread to place itself in the system-background cpuset given enough permissions. bug 25745866 Change-Id: I85f7e41c5439e6ad7cc2d355e51f5dfb3a0c7088
* Merge "Fix janky navbar ripples -- incorrect timerslack values" into mnc-devTodd Kjos2015-06-291-1/+3
|\
| * Fix janky navbar ripples -- incorrect timerslack valuesTodd Kjos2015-06-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a thread is created while the parent thread is "Background", then the default timerslack value gets set to the current timerslack value of the parent (40ms). The default value is used when transitioning to "Foreground" -- so the effect is that the timerslack value becomes 40ms regardless of foreground/background. This does occur intermittently for systemui when creating its render thread (pretty often on hammerhead and has been seen on shamu). If this occurs, then some systemui animations like navbar ripples can wait for up to 40ms to draw a frame when they intended to wait 3ms -- jank. This fix is to explicitly set the foreground timerslack to 50us. A consequence of setting timerslack behind the process' back is that any custom values for timerslack get lost whenever the thread has transition between fg/bg. See Bug: 19398120 Change-Id: Idc259717f62fa2255f8bafbbf88b68c0043f29cf
* | Don't set cgroup policy when updating cpusets.Tim Murray2015-06-221-4/+1
|/ | | | | | bug 21782794 Change-Id: I3b2cf8ae4f3ed0c14f206584ae7fa2b1a1d11ad0
* add cpuset support to libcutilsTim Murray2015-06-111-31/+86
| | | | | | bug 21782794 Change-Id: I249531754fb29442dc3c7434d77dbb103f4220a7
* am fae953eb: Merge "HAVE_ANDROID_OS implies that you have <pthread.h> and ↵Elliott Hughes2014-12-151-1/+1
|\ | | | | | | | | | | | | <sched.h>." * commit 'fae953ebccfabfa500b3ebca93202063c8e3501d': HAVE_ANDROID_OS implies that you have <pthread.h> and <sched.h>.
| * HAVE_ANDROID_OS implies that you have <pthread.h> and <sched.h>.Elliott Hughes2014-12-141-1/+1
| | | | | | | | Change-Id: Ica7940c00d1d5da9d50711fd138dd459deec9b6d
* | am 33b33549: Merge "Make the default cgroup, the foreground cgroup." into ↵Riley Andrews2014-10-081-23/+3
|\ \ | |/ |/| | | | | | | | | lmp-mr1-dev * commit '33b335495c7b8eea4b9af13a7157cf83cd085129': Make the default cgroup, the foreground cgroup.
| * Make the default cgroup, the foreground cgroup.Riley Andrews2014-10-071-23/+3
| | | | | | | | | | | | | | | | | | | | | | All kernel services will now be in the same cgroup as foreground applications. This will now make kernel threads not implicitly higher priority than android foreground services. Bug 17681097 Change-Id: I28e81c7aade50428d5395df86f00ce01c1e7af02
* | am 3859029a: am 7fb0ee0c: Merge "Remove androidGetTid."Elliott Hughes2014-08-181-4/+0
|\ \ | |/ |/| | | | | * commit '3859029a48aa78150fa61eb4988214f8632b33ce': Remove androidGetTid.
| * Remove androidGetTid.Elliott Hughes2014-08-181-4/+0
| | | | | | | | | | Bug: 17048545 Change-Id: I93cbb2d7bd18d506b5f5f7f262dd9ac0fca053b4
* | Move sched_policy.c off bionic's PR_SET_TIMERSLACK_PID.Elliott Hughes2014-07-171-0/+3
| | | | | | | | Change-Id: I3a27803d46b5b88a10aa8043a114d780ed685e56
* | Use <sys/prctl.h> instead of <linux/prctl.h>.Elliott Hughes2014-07-111-10/+2
| | | | | | | | Change-Id: I708da00e36a9da8be9184c451453774be6b78c06
* | am a0a461d3: am 82e1b89f: am a32e01d2: Merge "libcutils: turn on -Werror"Mark Salyzyn2014-05-021-9/+10
|\ \ | |/ | | | | | | * commit 'a0a461d3b7d85484c10db64f078427a5be3da189': libcutils: turn on -Werror
| * libcutils: turn on -WerrorMark Salyzyn2014-05-011-9/+10
| | | | | | | | | | | | - Deal with some -Wunused / -Wunused-variable issues Change-Id: I28c23fb213382a392ec30935749fb359e072d664
* | Fix build problems caused by commit:Ruchi Kandoi2014-04-241-1/+1
| | | | | | | | | | | | | | 422852ef5c0c2b0b5e031f80f480486df3d185a0 for non-linux hosts. Change-Id: I00b9c99b9d9d072f19549b3a9970a27e75cd49b7 Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
* | Set timer slack value according to thread foreground/background state.Ruchi Kandoi2014-04-231-0/+6
|/ | | | | Change-Id: Ia998f349129acf4602b767d1ff94839607fdbdbd Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
* cutils: sched_policy: remove audio app/sys groups, merge into fgDima Zavin2012-06-041-31/+4
| | | | | | Bug: 6528015 Change-Id: I6c2658b62442d811b53c6d18476fbd6cd45f9e3f Signed-off-by: Dima Zavin <dima@android.com>
* cutils: sched_policy: make bg group be nested under fgDima Zavin2012-06-041-4/+4
| | | | | | | | | Adds an apps cgroup which will contain fg tasks. Move the bg group nested underneath it. Bug: 6538553 Change-Id: I55279415da625e15a5bb061c2b45fbe7f7a4c047 Signed-off-by: Dima Zavin <dima@android.com>
* Revert "Revert "Use O_CLOEXEC when opening cgroup fds.""Jeff Brown2012-05-081-5/+5
| | | | This reverts commit 4df54bc4a85eacfff9c81dc0a7ebf3fd88a99982.
* Add stubs for host builds.Jeff Brown2012-05-081-17/+30
| | | | | Bug: 4466013 Change-Id: I5633c841e71a48357bb04cd7ccc02550c17bde22
* Revert "Use O_CLOEXEC when opening cgroup fds."Jeff Brown2012-05-081-5/+5
| | | This reverts commit e1440d81aef58e8b9983ab1f4540dc1fe5e63ab7
* Use O_CLOEXEC when opening cgroup fds.Jeff Brown2012-05-081-5/+5
| | | | | Bug: 4466013 Change-Id: I0d2e915fc550a0ecaccad5e452dd4c87fc878b8b
* Add more SP_ constantsGlenn Kasten2012-04-231-14/+80
| | | | Change-Id: I52c8ea33b9b915fc08546f2ca0b191391f58506b
* Scheduling group cleanup - add comment, SP_DEFAULTGlenn Kasten2012-04-201-0/+21
| | | | | | | | Also tid == 0 maps to gettid() on platforms that support it. This is needed by mediaserver code that was formerly using the old C++ API. Change-Id: I8baaa3e42315c9b924cec26b6da01e7cb69e0078
* Add get_sched_policy_name() and use in ps and topGlenn Kasten2012-03-151-0/+12
| | | | | | | This will make it easier to add additional policies (cgroups) if needed. Also added comments to the sched_policy APIs. Change-Id: I33ce1cc4deae10983241f7391294b7a512d2c47c
* fix windows SDK buildBrad Fitzpatrick2010-05-081-1/+3
| | | | Change-Id: I2c563b20197803cafa91214aeff2c06fc0c75580
* More fixes to Binder perf regression from EclairBrad Fitzpatrick2010-05-071-32/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Re-use the file descriptor to change the cgroups. There's a fast path in the kernel for the case where the value's already uncahnged. Also, this is okay because the kernel ignores the write offset. This is essentially a ioctl-ish/datagram interface, despite being a fd we're writing to. This reduces Dalvik->Dalvik void/void Binder calls on Sapphire from ~1.2 to ~0.8 ms. This is a bit slower than the ~0.7 ms we get avoiding the write altogether. strace confirms: [pid 1557] ioctl(21, 0xc0186201 <unfinished ...> [pid 1556] <... ioctl resumed> , 0x45399cd0) = 0 [pid 1556] write(22, "1556", 4) = 4 [pid 1556] ioctl(21, 0xc0186201 <unfinished ...> [pid 1555] <... ioctl resumed> , 0x45299cd0) = 0 [pid 1555] write(22, "1555", 4) = 4 [pid 1555] ioctl(21, 0xc0186201 <unfinished ...> [pid 1554] <... ioctl resumed> , 0x45199cd0) = 0 [pid 1554] write(22, "1554", 4) = 4 BUG=2660235 Change-Id: Ia9f9e1d5b792eaebc9560f89931faf6df0cf9c0d
* Optimize set_sched_policy(), which gets called in every binder call.Brad Fitzpatrick2010-05-061-16/+22
| | | | | | | | | | | - use static /dev/cpuctl filenames, rather than sprintf() on the fly - use a custom formatter instead of sprintf() for the tid number This is a simplified version of Dan's original Ifc9c81f74fe65f0695ead53b30194bc6adf00da0 to be less risky for Froyo. Bug: 2660235 Change-Id: I744bbc2ec01fd2569612c814a497df40a933b622
* system/core: Switch libsysutils & sched_policy LOG -> SLOGSan Mehat2010-03-251-7/+7
| | | | | Change-Id: Id74c6895a8012c5915f2e259339101844de7c085 Signed-off-by: San Mehat <san@google.com>
* cutils: sched_policy: Make getSchedulerGroup() play nicely with multiple ↵San Mehat2010-03-021-20/+44
| | | | | | control groups Signed-off-by: San Mehat <san@google.com>
* system: sched_policy: Don't return an error when the thread we're trying to ↵San Mehat2009-12-031-1/+10
| | | | | | move exits on us Signed-off-by: San Mehat <san@google.com>
* cutils: sched_policy: Fix bug where we were unable to move backgrounded ↵San Mehat2009-10-291-3/+5
| | | | | | threads into the foreground Signed-off-by: San Mehat <san@google.com>
* cutils: schedpolicy: Add debug code to log sched policy transitionsSan Mehat2009-10-291-0/+37
| | | | Signed-off-by: San Mehat <san@google.com>
* cutils: Add support for reading a processes scheduler policySan Mehat2009-10-271-3/+88
| | | | Signed-off-by: San Mehat <san@google.com>
* Disable sched_policy under Windows.Raphael2009-09-151-0/+6
| | | | | | | This introduces a new HAVE_SCHED_H arch define, which is used to prevent from building sched_policy.c during the Windows SDK. Change-Id: I3667857a4ae7d6baaf1efd1cd187a5baf91419d8
* libcutils: Dont include kernel header + add definesSan Mehat2009-09-141-1/+8
| | | | Signed-off-by: San Mehat <san@google.com>
* libcutils: Add abstracted support for setting scheduler policiesSan Mehat2009-09-121-0/+84
Also changes the background policy to use SCHED_BATCH. IDLEPRIO can cause 100% starvation. Signed-off-by: San Mehat <san@google.com>