Hi,

On Wed, Jul 18, 2012 at 2:56 AM, Andrey Zonov <and...@zonov.org> wrote:
> Index: sys/sys/refcount.h
> ===================================================================
> --- sys/sys/refcount.h  (revision 234600)
> +++ sys/sys/refcount.h  (working copy)
> @@ -51,6 +51,7 @@ static __inline void
>  refcount_acquire(volatile u_int *count)
>  {
>
> +       KASSERT(*count < 0xffffff00, ("refcount %p is overflowed", count));
>         atomic_add_acq_int(count, 1);
>  }
>
>
> It will give better diagnostic when refcount is overflowed, instead of
> "negative refcount".
>
this is completely bogus. Why arbitrarily use 0xffffff00, why not
0xdeadbeef or 0xbabeb00b ? 0xfffffffe is a perfectly valid reference
count value. The only logical assertion would be to check if the
increment is to trigger an overflow of the underlying type used to
store the reference count value. That is (*count < 0xffffffff).
Moreover, advertising the current value of the counter in the panic
message is absolutely useless...

 - Arnaud
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "freebsd-net-unsubscr...@freebsd.org"

Reply via email to