From rwatson@FreeBSD.org Mon Feb 2 21:59:22 2004 Date: Sun, 1 Feb 2004 17:49:34 -0800 (PST) From: Robert Watson To: Perforce Change Reviews Subject: PERFORCE change 46333 for review http://perforce.freebsd.org/chv.cgi?CH=46333 Change 46333 by rwatson@rwatson_paprika on 2004/02/01 17:48:48 Don't dec/inc the amountpipes counter every time we resize a pipe -- instead, just dec/inc in the ctor/dtor. This variable now counts the number of pipes, not pipe halves -- i.e., its scale is 1/2 what it was previously. Affected files ... .. //depot/user/rwatson/pipe/sys/kern/sys_pipe.c#10 edit Differences ... ==== //depot/user/rwatson/pipe/sys/kern/sys_pipe.c#10 (text+ko) ==== @@ -255,6 +255,7 @@ */ pp->pp_label = NULL; + atomic_add_int(&amountpipes, 1); } static void @@ -265,6 +266,8 @@ KASSERT(size == sizeof(*pp), ("pipe_zone_dtor: wrong size")); pp = (struct pipepair *)mem; + + atomic_subtract_int(&amountpipes, 1); } static void @@ -428,7 +431,6 @@ cpipe->pipe_buffer.in = 0; cpipe->pipe_buffer.out = 0; cpipe->pipe_buffer.cnt = 0; - atomic_add_int(&amountpipes, 1); atomic_add_int(&amountpipekva, cpipe->pipe_buffer.size); return (0); } @@ -1410,7 +1412,6 @@ if (cpipe->pipe_buffer.size > PIPE_SIZE) atomic_subtract_int(&nbigpipe, 1); atomic_subtract_int(&amountpipekva, cpipe->pipe_buffer.size); - atomic_subtract_int(&amountpipes, 1); vm_map_remove(pipe_map, (vm_offset_t)cpipe->pipe_buffer.buffer, (vm_offset_t)cpipe->pipe_buffer.buffer + cpipe->pipe_buffer.size);