From f842886e9039138325e25cf474e595c84b4708f9 Mon Sep 17 00:00:00 2001 From: Michal Bloch Date: Mon, 26 Nov 2018 11:36:39 +0100 Subject: [PATCH] =?utf8?q?libdlog:=20reduce=20pipe=20size=201=20MB=20?= =?utf8?q?=E2=86=92=2064=20kB?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It seems that the amount of memory allocated specifically to pipes can be limited and on most targets it seems to be set to 16k pages, that is, 64 MB raw memory. Pipes are currently very aggressively sized which burns through this limit easily. 64 kB is still quite a lot and should not cause any problems to prolific loggers while heavily culling memory wastage. Change-Id: I5465de849a279e23ca0d6bae34bceddd6136db16 Signed-off-by: Michal Bloch --- src/logger/logger.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/logger/logger.c b/src/logger/logger.c index c12dac4..158915e 100644 --- a/src/logger/logger.c +++ b/src/logger/logger.c @@ -62,7 +62,15 @@ enum { enum { FALSE = 0, TRUE }; -#define PIPE_REQUESTED_SIZE (256*4096) +/* Size in bytes of the pipe given to libdlog clients. + * The default size (1 page, usually 4 kiB) is fairly small + * which leads programs that log a lot to easily clog the + * pipe. On the other hand, the amount of memory allocated + * to pipes specifically can be limited and on most relevant + * targets seems to be set to 16ki pages (64 MiB raw memory) + * so pipes should not be too large so as not to waste it. */ +#define PIPE_REQUESTED_SIZE (64 * 1024) // 16 pages at 4 kiB per page + #define FILE_PATH_SIZE (256) #define MAX_CONNECTION_Q 100 #define DELIMITER " " -- 2.7.4