OSDN Git Service

Correctly set minimum priority on nodes.
authorMartijn Coenen <maco@google.com>
Fri, 5 May 2017 18:16:59 +0000 (11:16 -0700)
committerMartijn Coenen <maco@google.com>
Fri, 5 May 2017 18:32:01 +0000 (18:32 +0000)
commit2b6317436d2035ce98331906aaaca87e6026c9c8
treedc081fafbe054cfc07a27b84b78028542713f06d
parentbb54a7df3a42d4beeb5fd99e01369415a7d1c24c
Correctly set minimum priority on nodes.

It looks like libbinder has always set the minimum priority
for a node to 0x7f (127). This is an invalid value as far
as the kernel is concerned, since the current driver only
accepts positive nice values (0..19). The effect of using
0xf7 is that the nice value was clamped to MAX_NICE (19) -
so effectively the kernel never raised the priority
based on the min_priority setting of a node. Correct this
by just using MAX_NICE directly.

Additionally, a recent change removed the use of the
gDisableBackgroundScheduling flag, which system_server
used to make sure that incoming transactions were not
executed at a lower priority. That behavior is actually
still desired, so this change sets the min_priorirty
value to 0 for processes that have requested background
scheduling to be disabled. The effect of that is that
all transactions into those nodes will be executed with
a priority of at least nice 0 (and potentially higher,
depending on the priority of the caller).

Bug: 37677242
Test: verified /d/binder output
Change-Id: I7cbfd309d04cbd052f868fbfe0930529ff21a48a
libs/binder/IPCThreadState.cpp
libs/binder/Parcel.cpp
libs/binder/include/binder/IPCThreadState.h