lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071024014920.GU27248@parisc-linux.org>
Date:	Tue, 23 Oct 2007 19:49:20 -0600
From:	Matthew Wilcox <matthew@....cx>
To:	Matt Mackall <mpm@...enic.com>
Cc:	torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org,
	Matthew Wilcox <willy@...ux.intel.com>
Subject: Re: [PATCH 1/4] stringbuf: A string buffer implementation

On Tue, Oct 23, 2007 at 05:11:16PM -0500, Matt Mackall wrote:
> You might want to consider growing the buffer by no less than a small
> constant factor like 1.3x. This will keep things that do short concats
> in a loop from degrading to O(n^2) performance due to realloc and
> memcpy.

I looked at slab and slub, and would grow the buffer by no less than
1.5x each time, thanks to the buckets.  I'd initially implemented 2x,
but switched to allocating size+1 and calling ksize() as being a more
efficient implementation.

I presume slob is different?  Actually, slob doesn't seem to
provide krealloc, so I think stringbuf won't work on slob.  Will you
have time to fix this?

> Should probably just bite the bullet and pass a flag.

Hrm.

extern void sb_printf(struct stringbuf *sb, gfp_t gfp, const char *fmt, ...)
        __attribute__((format(printf, 3, 4)));

?  Any objections?

> > +#define INITIAL_SIZE 32
> 
> Too small. That will guarantee that most users end up doing a realloc.
> Can we have 128 instead?

I don't care.  Sure!

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ