New issue
Advanced search Search tips

Issue 801355 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Enable background OS threads in TaskScheduler on Android

Project Member Reported by dskiba@chromium.org, Jan 11 2018

Issue description

Currently all task scheduler threads run with NORMAL thread priority on Android. One of the reasons is because PlatformThread::CanIncreaseCurrentThreadPriority() returns false. But Android is unique because Chrome processes are never shut down - they are killed, either by Chrome or by Android itself.

Given that, can we #ifndef ANDROID portion of GetDesiredThreadPriority() code that deals with shutdown (and checks for CanIncreaseCurrentThreadPriority)?

Additionally, what was the reason for adding HandlesMultipleThreadPriorities() check - is it also related to shutdown?
 

Comment 1 by dskiba@chromium.org, Jan 18 2018

Status: WontFix (was: Untriaged)
OK, I dug a bit more, and found that PTHREAD_PRIO_INHERIT is simply not available on Android. I.e. we can't make HandlesMultipleThreadPriorities() return true, and we can't ignore it in GetDesiredThreadPriority() either, or else we'll suffer from priority inversion.

See b/29177606 for request to add PTHREAD_PRIO_INHERIT.

Comment 2 by gab@chromium.org, Feb 12 2018

Components: Internals>TaskScheduler
Status: Untriaged (was: WontFix)
This is worth resolving now.

Comment 3 by gab@chromium.org, Apr 12 2018

Labels: Hotlist-GoodFirstBug

Comment 4 by gab@chromium.org, May 3 2018

Status: Available (was: Untriaged)
Summary: Enable background OS threads in TaskScheduler on Android (was: Don't handle task scheduler shutdown on Android)
Need a runtime check to only to do this after the Android version supporting it (ref. http://b/29177606).

Need to remove the requirement to be able to up priority on shutdown since Android doesn't shutdown.
Cc: skyos...@chromium.org
Owner: ksolt@chromium.org
Status: Assigned (was: Available)
Cc: lizeb@chromium.org
lizeb@ mentioned that we should be careful here as there's a level of backgrounding on Android that puts you in a cgroup that implies a single thread (precise nice value can be found in Android source he mentioned)

Sign in to add a comment