[Openais] [PATCH 2/2] flight recorder: enable temporary 0 buffer size protection

Fabio M. Di Nitto fdinitto at redhat.com
Thu Jun 18 07:18:53 PDT 2009


The flight recoder doesn't handle a 0 byte allocation properly
and it would fail miserably by allocating a single PAGE_SIZE
to handle the logging. That means an enormous performance hit
because of the constant wrapping around the buffer.

If any requested buffer is < 64000 bytes, then force to at least
64000.

In future we will be able to handle small buffers properly, but
for now enable a simple workaround to protect us and the user.

Signed-off-by: Fabio M. Di Nitto <fdinitto at redhat.com>
---
:100644 100644 d46d72e... d512b7f... M	exec/logsys.c
 exec/logsys.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/exec/logsys.c b/exec/logsys.c
index d46d72e..d512b7f 100644
--- a/exec/logsys.c
+++ b/exec/logsys.c
@@ -1057,6 +1057,17 @@ int _logsys_rec_init (unsigned int fltsize)
 	 */
 	size_t flt_real_size;
 
+	/*
+	 * XXX: kill me for 1.1 because I am a dirty hack
+	 * temporary workaround that will be replaced by supporting
+	 * 0 byte size flight recorder buffer.
+	 * 0 byte size buffer will enable direct printing to logs
+	 *   without flight recoder.
+	 */
+	if (fltsize < 64000) {
+		fltsize = 64000;
+	}
+
 	flt_real_size = roundup(
 			(fltsize + (2 * sizeof (unsigned int))),
 			sysconf(_SC_PAGESIZE));
-- 
1.5.4.3



More information about the Openais mailing list