From linimon@FreeBSD.org  Tue May 22 03:03:56 2012
Return-Path: <linimon@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id A1172106566C
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 22 May 2012 03:03:56 +0000 (UTC)
	(envelope-from linimon@FreeBSD.org)
Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28])
	by mx1.freebsd.org (Postfix) with ESMTP id 8B7128FC15
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 22 May 2012 03:03:56 +0000 (UTC)
Received: from freefall.freebsd.org (localhost [127.0.0.1])
	by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q4M33uug066826
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 22 May 2012 03:03:56 GMT
	(envelope-from linimon@freefall.freebsd.org)
Received: (from linimon@localhost)
	by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q4M33uGe066825;
	Tue, 22 May 2012 03:03:56 GMT
	(envelope-from linimon)
Message-Id: <201205220303.q4M33uGe066825@freefall.freebsd.org>
Date: Tue, 22 May 2012 03:03:56 GMT
From: Mark Linimon <linimon@FreeBSD.org>
Reply-To: Mark Linimon <linimon@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [kernel] why is the type of ub_cnt signed in uma_int.h?
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         168213
>Category:       kern
>Synopsis:       [kernel] why is the type of ub_cnt signed in uma_int.h?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 22 03:10:02 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Mark Linimon
>Release:        FreeBSD 9.0-STABLE i386
>Organization:
FreeBSD
>Environment:
System: FreeBSD freefall.freebsd.org 9.0-STABLE FreeBSD 9.0-STABLE #6 r235139: Tue May 8 21:19:03 UTC 2012 simon@freefall.freebsd.org:/usr/obj/usr/src/sys/FREEFALL i386
>Description:
While looking at a problem for a customer, I was confused by the outputs
of number of free items and number of entries in uma_int.h.  Shouldn't
these two entities be unsigned instead of signed?
>How-To-Repeat:
>Fix:
This isn't a fix, as much as grounds for discussion.

Index: uma_int.h
===================================================================
RCS file: /home/FreeBSD/ncvs/src/sys/vm/uma_int.h,v
retrieving revision 1.46
diff -u -r1.46 uma_int.h
--- uma_int.h	21 May 2011 17:43:43 -0000	1.46
+++ uma_int.h	13 Apr 2012 17:06:48 -0000
@@ -174,8 +174,8 @@
 
 struct uma_bucket {
 	LIST_ENTRY(uma_bucket)	ub_link;	/* Link into the zone */
-	int16_t	ub_cnt;				/* Count of free items. */
-	int16_t	ub_entries;			/* Max items. */
+	u_int16_t	ub_cnt;			/* Count of free items. *//* XXX MCL was int64_t? */
+	u_int16_t	ub_entries;		/* Max items. *//* XXX MCL was int64_t? */
 	void	*ub_bucket[];			/* actual allocation storage */
 };
 
>Release-Note:
>Audit-Trail:
>Unformatted:
