PERFORCE change 85946 for review
Todd Miller
millert at FreeBSD.org
Thu Oct 27 19:42:35 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=85946
Change 85946 by millert at millert_ibook on 2005/10/27 19:41:45
Add sebsd_malloc_init() to populate the free list with
a large number of small allocations (512). This prevents
a panic due to free list exhaustion caused by non-blocking
allocation early on in avc_init(). Not very nice but
a workaround until we have a better solution.
Affected files ...
.. //depot/projects/trustedbsd/sedarwin7/src/sedarwin/sedarwin/sebsd.c#16 edit
Differences ...
==== //depot/projects/trustedbsd/sedarwin7/src/sedarwin/sedarwin/sebsd.c#16 (text+ko) ====
@@ -76,6 +76,27 @@
#include <vm/vm_kern.h>
#include <kern/kalloc.h>
+/*
+ * XXX
+ * Hack to populate the free list with lots of small allocations.
+ * Needed to make non-blocking allocations work early on in the
+ * boot sequence. Otherwise we crash in avc_init().
+ * XXX
+ *
+void
+sebsd_malloc_init(void)
+{
+ int i;
+ void *prealloc[512];
+
+ for (i = 0; i < 512; i++) {
+ if ((prealloc[i] = kalloc(64)) == NULL)
+ break;
+ }
+ while (i--)
+ kfree(prealloc[i], 64);
+}
+
void *
sebsd_malloc(size_t size, int flags)
{
@@ -132,6 +153,7 @@
{
printf("sebsd:: init\n");
+ sebsd_malloc_init();
avc_init();
//sebsd_register_sysctls();
if (security_init()) {
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list