PERFORCE change 166481 for review
Andre Oppermann
andre at FreeBSD.org
Thu Jul 23 22:18:00 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166481
Change 166481 by andre at andre_t61 on 2009/07/23 22:17:46
Add uma_zone_get_max() reporting the actual rounded up maximum
of items in a zone (if limited by uma_zone_set_max).
Affected files ...
.. //depot/projects/tcp_reass/vm/uma.h#5 edit
.. //depot/projects/tcp_reass/vm/uma_core.c#6 edit
Differences ...
==== //depot/projects/tcp_reass/vm/uma.h#5 (text+ko) ====
@@ -451,7 +451,8 @@
* Sets a high limit on the number of items allowed in a zone
*
* Arguments:
- * zone The zone to limit
+ * zone The zone to limit
+ * nitems The maximum number of items (will be rounded up to slab (page) size)
*
* Returns:
* Nothing
@@ -459,6 +460,18 @@
void uma_zone_set_max(uma_zone_t zone, int nitems);
/*
+ * Returns the high limit on the number of items allowed in a zone
+ *
+ * Arguments:
+ * zone The zone to report
+ *
+ * Returns:
+ * 0 unlimited
+ * >0 The effective maximum number of items allowed
+ */
+int uma_zone_get_max(uma_zone_t zone);
+
+/*
* The following two routines (uma_zone_set_init/fini)
* are used to set the backend init/fini pair which acts on an
* object as it becomes allocated and is placed in a slab within
==== //depot/projects/tcp_reass/vm/uma_core.c#6 (text+ko) ====
@@ -2799,6 +2799,24 @@
}
/* See uma.h */
+int
+uma_zone_get_max(uma_zone_t zone)
+{
+ int items;
+ uma_keg_t keg;
+
+ ZONE_LOCK(zone);
+ keg = zone_first_keg(zone);
+ if (keg->uk_maxpages > 0)
+ items = keg->uk_maxpages * keg->uk_ipers;
+ else
+ items = 0;
+ ZONE_UNLOCK(zone);
+
+ return (items);
+}
+
+/* See uma.h */
void
uma_zone_set_init(uma_zone_t zone, uma_init uminit)
{
More information about the p4-projects
mailing list