Hi Chunhai,
On 2024/3/22 19:48, Chunhai Guo wrote:
It will cost more time if compressed buffers are allocated on demand for
low-latency algorithms (like lz4) so EROFS uses per-CPU buffers to keep
compressed data if in-place decompression is unfulfilled. While it is kind
of wasteful of memory for a device with hundreds of CPUs, and only a small
number of CPUs concurrently decompress most of the time.
This patch renames it as 'global buffer pool' and makes it configurable.
This allows two or more CPUs to share a common buffer to reduce memory
occupation.
Signed-off-by: Chunhai Guo <guochun...@vivo.com>
Suggested-by: Gao Xiang <xi...@kernel.org>
---
...
diff --git a/fs/erofs/utils.c b/fs/erofs/utils.c
index e146d09151af..7b552bb8c36e 100644
--- a/fs/erofs/utils.c
+++ b/fs/erofs/utils.c
@@ -284,4 +284,152 @@ void erofs_exit_shrinker(void)
{
shrinker_free(erofs_shrinker_info);
}
+
+struct z_erofs_gbuf {
+ spinlock_t lock;
+ void *ptr;
+ struct page **pages;
+ unsigned int nrpages;
+};
+
+struct z_erofs_gbuf *z_erofs_gbufpool;
+unsigned int z_erofs_gbuf_count, z_erofs_gbuf_nrpages;
I'd rather to:
static struct z_erofs_gbuf *z_erofs_gbufpool;
static unsigned int z_erofs_gbuf_count, z_erofs_gbuf_nrpages;
You could send out a quick v3 or I could manually modify this
later.
Otherwise it looks good to me,
Reviewed-by: Gao Xiang <hsiang...@linux.alibaba.com>
Thanks,
Gao Xiang