From 30dbaa2016dd9a8377f9768d7e86fdcf7e4ebb44 Mon Sep 17 00:00:00 2001 From: Sungtak Lee Date: Thu, 3 Oct 2019 14:38:01 -0700 Subject: [PATCH] bufferpool@2.0 tune eviction params bufferpool tries to manage memory consumption as low as 15MB usually. Since it is too harsh for graphic input buffer use cases, if # of buffers are under certain threshold make bufferpool ignore total memory consumption. Bug: 141605804 Change-Id: I20bd0438fede018e26984e0e3bc9a2007b0bc29b --- media/bufferpool/2.0/AccessorImpl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/media/bufferpool/2.0/AccessorImpl.cpp b/media/bufferpool/2.0/AccessorImpl.cpp index cacd465706..0d591d78a9 100644 --- a/media/bufferpool/2.0/AccessorImpl.cpp +++ b/media/bufferpool/2.0/AccessorImpl.cpp @@ -37,7 +37,7 @@ namespace { static constexpr int64_t kLogDurationUs = 5000000; // 5 secs static constexpr size_t kMinAllocBytesForEviction = 1024*1024*15; - static constexpr size_t kMinBufferCountForEviction = 40; + static constexpr size_t kMinBufferCountForEviction = 25; } // Buffer structure in bufferpool process @@ -718,8 +718,8 @@ void Accessor::Impl::BufferPool::cleanUp(bool clearCache) { mStats.mTotalFetches, mStats.mTotalTransfers); } for (auto freeIt = mFreeBuffers.begin(); freeIt != mFreeBuffers.end();) { - if (!clearCache && mStats.mSizeCached < kMinAllocBytesForEviction - && mBuffers.size() < kMinBufferCountForEviction) { + if (!clearCache && (mStats.mSizeCached < kMinAllocBytesForEviction + || mBuffers.size() < kMinBufferCountForEviction)) { break; } auto it = mBuffers.find(*freeIt);