diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-02-12 20:20:52 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-02-12 20:20:52 +0000 |
commit | f3eaeb99a3e3f11d3227778f4a0191c923df992b (patch) | |
tree | a9fed8c6e04bffc5d2649f71568099403af69978 /src/or/buffers.c | |
parent | dc94b1a226c21b5ac337d79f51bc10cd91b42e04 (diff) | |
download | tor-f3eaeb99a3e3f11d3227778f4a0191c923df992b.tar.gz tor-f3eaeb99a3e3f11d3227778f4a0191c923df992b.zip |
r18051@catbus: nickm | 2008-02-12 15:20:43 -0500
Re-tune mempool parametes based on testing on peacetime: use smaller chuncks, free them a little more aggressively, and try very hard to concentrate allocations on fuller chunks. Also, lots of new documentation.
svn:r13484
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r-- | src/or/buffers.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c index ad855b1478..df6b3ed6a0 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -20,6 +20,8 @@ const char buffers_c_id[] = //#define NOINLINE #ifdef PARANOIA +/** Helper: If PARANOIA is defined, assert that the buffer in local variable + * <b>buf</b> is well-formed. */ #define check() STMT_BEGIN assert_buf_ok(buf); STMT_END #else #define check() STMT_NIL @@ -124,6 +126,8 @@ static chunk_freelist_t freelists[] = { FL(0, 0, 0) }; #undef FL +/** How many times have we looked for a chunk of a size that no freelist + * could help with? */ static uint64_t n_freelist_miss = 0; static void assert_freelist_ok(chunk_freelist_t *fl); @@ -232,7 +236,7 @@ chunk_grow(chunk_t *chunk, size_t sz) #define MIN_READ_LEN 8 /** Every chunk should take up at least this many bytes. */ #define MIN_CHUNK_ALLOC 256 -/*XXXX020 enforce this maximum. */ +/** No chunk should take up more than this many bytes. */ #define MAX_CHUNK_ALLOC 65536 /** Return the allocation size we'd like to use to hold <b>target</b> @@ -549,7 +553,7 @@ buf_add_chunk_with_capacity(buf_t *buf, size_t capacity, int capped) } /** Read up to <b>at_most</b> bytes from the socket <b>fd</b> into - * <b>chunk</b> (which must be on <b>buf/b>). If we get an EOF, set + * <b>chunk</b> (which must be on <b>buf</b>). If we get an EOF, set * *<b>reached_eof</b> to 1. Return -1 on error, 0 on eof or blocking, * and the number of bytes read otherwise. */ static INLINE int |