PERFORCE change 95987 for review
John Birrell
jb at FreeBSD.org
Mon Apr 24 03:53:27 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=95987
Change 95987 by jb at jb_freebsd2 on 2006/04/24 03:52:59
Just allocate buffer memory for the maximum number of cpus.
Affected files ...
.. //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_buffer.c#3 edit
Differences ...
==== //depot/projects/dtrace/src/sys/cddl/dev/dtrace/dtrace_buffer.c#3 (text+ko) ====
@@ -69,8 +69,7 @@
dtrace_buffer_alloc(dtrace_buffer_t *bufs, size_t size, int flags,
processorid_t cpu)
{
-printf("%s:%s(%d): DOODAD\n",__FUNCTION__,__FILE__,__LINE__);
-#ifdef DOODAD
+#if defined(sun)
cpu_t *cp;
dtrace_buffer_t *buf;
@@ -142,9 +141,51 @@
buf->dtb_xamot = NULL;
buf->dtb_size = 0;
} while ((cp = cp->cpu_next) != cpu_list);
-#endif
return (ENOMEM);
+#else
+ dtrace_buffer_t *buf;
+ int i;
+
+ ASSERT(MUTEX_HELD(&dtrace_lock));
+ for (i = 0; i < mp_ncpus; i++) {
+ buf = &bufs[i];
+
+ /*
+ * If there is already a buffer allocated for this CPU, it
+ * is only possible that this is a DR event. In this case,
+ * the buffer size must match our specified size.
+ */
+ if (buf->dtb_tomax != NULL) {
+ ASSERT(buf->dtb_size == size);
+printf("buf->dtb_size %ld size %ld\n",(long) buf->dtb_size,(long) size);
+ continue;
+ }
+
+ ASSERT(buf->dtb_xamot == NULL);
+
+ /*
+ * XXX Hack.
+ * This should be KM_NOSLEEP with error handling if low on
+ * memory.
+ */
+ buf->dtb_tomax = kmem_zalloc(size, KM_SLEEP);
+
+ buf->dtb_size = size;
+ buf->dtb_flags = flags;
+ buf->dtb_offset = 0;
+ buf->dtb_drops = 0;
+
+ /*
+ * XXX Hack.
+ * This should be KM_NOSLEEP with error handling if low on
+ * memory.
+ */
+ buf->dtb_xamot = kmem_zalloc(size, KM_SLEEP);
+ }
+
+ return (0);
+#endif
}
/*
More information about the p4-projects
mailing list