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

Fabio M. Di Nitto fdinitto at redhat.com
Thu Jun 18 10:22:19 PDT 2009


On Thu, 2009-06-18 at 08:25 -0700, Steven Dake wrote:
> could you use sysconf to determine the page size and multiply it by some
> value to equal 64k?

It happens 2 lines right after we set 64000 anyway... if you want I can
duplicate it, but it would happen again right after.. I don't mind
either way.

Fabio

> 
> Regards
> -steve
> 
> On Thu, 2009-06-18 at 15:14 +0200, Fabio M. Di Nitto wrote:
> > 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 904e631... 93eb154... 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 904e631..93eb154 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));
> 



More information about the Openais mailing list