diff options
author | Mark Salyzyn <salyzyn@google.com> | 2015-04-20 15:36:12 -0700 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2015-04-22 11:53:29 -0700 |
commit | d717d805d4d636a837ccfba87c78b0dc89cb8fd9 (patch) | |
tree | a2314b3f8e2ddc11774330fa03f3c2ffc09e0902 /logd | |
parent | f75f16a1ddbe6cde5e44036d48dc7a6c62d38cc0 (diff) | |
download | system_core-d717d805d4d636a837ccfba87c78b0dc89cb8fd9.zip system_core-d717d805d4d636a837ccfba87c78b0dc89cb8fd9.tar.gz system_core-d717d805d4d636a837ccfba87c78b0dc89cb8fd9.tar.bz2 |
logd: per UID less aggressive 12.5% threshold
Per-UID quota has a threshold of 12.5% of the total log size.
If less than that space is taken by the UID, then we
will not engage the pruning based on worst UID.
Change-Id: I9f15c9a26938f1115eb75e9c28ddb073e7680e06
Diffstat (limited to 'logd')
-rw-r--r-- | logd/LogBuffer.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp index 1859461..d0f0a89 100644 --- a/logd/LogBuffer.cpp +++ b/logd/LogBuffer.cpp @@ -349,9 +349,16 @@ void LogBuffer::prune(log_id_t id, unsigned long pruneRows, uid_t caller_uid) { if (sorted.get()) { if (sorted[0] && sorted[1]) { - worst = sorted[0]->getKey(); worst_sizes = sorted[0]->getSizes(); - second_worst_sizes = sorted[1]->getSizes(); + // Calculate threshold as 12.5% of available storage + size_t threshold = log_buffer_size(id) / 8; + if (worst_sizes > threshold) { + worst = sorted[0]->getKey(); + second_worst_sizes = sorted[1]->getSizes(); + if (second_worst_sizes < threshold) { + second_worst_sizes = threshold; + } + } } } } |