PERFORCE change 90670 for review
Alan Cox
alc at FreeBSD.org
Sun Jan 29 23:48:45 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=90670
Change 90670 by alc at alc_home on 2006/01/30 07:48:35
Add a sysctl for displaying the cache queue.
Affected files ...
.. //depot/projects/superpages/src/sys/vm/vm_buddy.c#12 edit
Differences ...
==== //depot/projects/superpages/src/sys/vm/vm_buddy.c#12 (text+ko) ====
@@ -53,6 +53,11 @@
SYSCTL_OID(_vm, OID_AUTO, buddy, CTLTYPE_STRING | CTLFLAG_RD,
NULL, 0, sysctl_vm_buddy, "A", "Buddy Info");
+static int sysctl_vm_cacheq(SYSCTL_HANDLER_ARGS);
+
+SYSCTL_OID(_vm, OID_AUTO, cacheq, CTLTYPE_STRING | CTLFLAG_RD,
+ NULL, 0, sysctl_vm_cacheq, "A", "Cache Queue Info");
+
static __inline void buddyq_insert(int baseq, int q, vm_page_t m);
static __inline void buddyq_remove(vm_page_t m);
static __inline void buddyq_split(vm_page_t m, int q, int Q);
@@ -87,6 +92,31 @@
/*
*
*/
+static int
+sysctl_vm_cacheq(SYSCTL_HANDLER_ARGS)
+{
+ struct sbuf sbuf;
+ char *cbuf;
+ const int cbufsize = (BUDDY_QUEUES + 1)*81;
+ int error, q;
+
+ cbuf = malloc(cbufsize, M_TEMP, M_WAITOK | M_ZERO);
+ sbuf_new(&sbuf, cbuf, cbufsize, SBUF_FIXEDLEN);
+ sbuf_printf(&sbuf, "\nORDER SIZE NUMBER\n\n");
+ for (q = BUDDY_QUEUES - 1; q >= 0; q--)
+ sbuf_printf(&sbuf, "%5.5d: %6.6dK, %6.6d\n", q,
+ 1 << (PAGE_SHIFT - 10 + q),
+ vm_page_queues[PQ_CACHE + q].lcnt);
+ sbuf_finish(&sbuf);
+ error = SYSCTL_OUT(req, sbuf_data(&sbuf), sbuf_len(&sbuf));
+ sbuf_delete(&sbuf);
+ free(cbuf, M_TEMP);
+ return (error);
+}
+
+/*
+ *
+ */
static __inline void
buddyq_insert(int baseq, int q, vm_page_t m)
{
More information about the p4-projects
mailing list