journal: limit the number of entries in the cache based on available memory
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 22 Jan 2019 15:12:52 +0000 (16:12 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 26 Jan 2019 11:42:52 +0000 (12:42 +0100)
commitb12a480829c5ca8f4d4fa9cde8716b5f2f12a3ad
tree10b151af6d173822477ec4323969fe86e9ba3f0c
parentef21b3b5bf824e652addf850bcfd9374c7b33ce8
journal: limit the number of entries in the cache based on available memory

This is far from perfect, but should give mostly reasonable values. My
assumption is that if somebody has a few hundred MB of memory, they are
unlikely to have thousands of processes logging. A hundred would already be a
lot. So let's scale the cache size propritionally to the total memory size,
with clamping on both ends.

The formula gives 64 cache entries for each GB of RAM.
src/journal/journald-context.c