Adrian wrote:
> - fd_set slowfds;
> + char slowfds[SQUID_MAXFD];
> -static fd_set delay_no_delay;
> +static int delay_no_delay[SQUID_MAXFD];
Firstly, either decide on an int array or a char array to replace
the current bitmask. On a typical 8k FD cache, that's either
8kb or 32kb rather than the current 1kb for the bitmask, which
may seem like not much memory but remember on the one hand,
people are running caches on systems with pretty small CPU caches,
and on the other hand, ints may be faster to access than bitmasks
on some faster/larger machines - so it's a tradeoff either way.
Secondly, as per Henrik, confirm that use of the fd_set is the cause
of your brokenness.
Thirdly, you could consider using your own bitmask structure and
the FD_SET/FD_CLR/etc functions. Only FD_ZERO won't work on an
incorrectly sized structure as it references the calculated size
of an fd_set.
If you look on Linux, you'll find these are defined to something
like:
# define __FD_SET(fd, fdsp) \
__asm__ __volatile__ ("btsl %1,%0"
: "=m" (__FDS_BITS (fdsp)[__FDELT (fd)])
: "r" (((int) (fd)) % __NFDBITS)
: "cc","memory")
ie - rather fast opcodes to access an array of longs as a
bitmask.
David.
Received on Sun Mar 14 2004 - 23:48:47 MST
This archive was generated by hypermail pre-2.1.9 : Thu Apr 01 2004 - 12:00:04 MST