Make isAppBad() lock-free
We trade off increased cost of (rare) mutations of the set of "bad" apps in order to make the core lookup "is this specific app bad?" lock-free. Locking discipline turned out to be a dominant cost in a very hot code path within the running system, even uncontended. Bug: 175339368 Bug: 163297662 Test: atest ActivityManagerServiceTest Change-Id: I8803a177d46b01b86897f1e8d0966eb2452849fd Merged-In: I8803a177d46b01b86897f1e8d0966eb2452849fd
This commit is contained in:
@@ -22,7 +22,7 @@ import android.util.SparseArray;
|
||||
public class ProcessMap<E> {
|
||||
final ArrayMap<String, SparseArray<E>> mMap
|
||||
= new ArrayMap<String, SparseArray<E>>();
|
||||
|
||||
|
||||
public E get(String name, int uid) {
|
||||
SparseArray<E> uids = mMap.get(name);
|
||||
if (uids == null) return null;
|
||||
@@ -58,4 +58,6 @@ public class ProcessMap<E> {
|
||||
public int size() {
|
||||
return mMap.size();
|
||||
}
|
||||
|
||||
public void putAll(ProcessMap<E> other) { mMap.putAll(other.mMap); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user