libdlog: reduce pipe size 1 MB → 64 kB 90/193790/2 accepted/tizen/unified/20181127.133459 submit/tizen/20181127.023050
authorMichal Bloch <m.bloch@samsung.com>
Mon, 26 Nov 2018 10:36:39 +0000 (11:36 +0100)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Tue, 27 Nov 2018 02:29:45 +0000 (02:29 +0000)
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 <m.bloch@samsung.com>
src/logger/logger.c

index c12dac4..158915e 100644 (file)
@@ -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 " "