Re: kernel/5761: improve kernel malloc

Previous thread: wdc_obio at macppc: timeouting and seldom system blocks by Peter Kun on Sunday, March 23, 2008 - 12:00 pm. (1 message)

Next thread: Re: kernel/5761: improve kernel malloc by mickey on Monday, March 24, 2008 - 6:55 am. (1 message)
To: <gnats@...>, <bugs@...>
Date: Monday, March 24, 2008 - 6:38 am

re
just for the record -- patch works fine on hppa
that is a pmap_direct architecture.
cu

--
paranoic mickey (my employers have changed but, the name has remained)

To: <gnats@...>, <bugs@...>
Date: Tuesday, March 25, 2008 - 11:04 am

re
one liner fix to make it work on sparc64 (MINBUCKET changed)
cu
--
paranoic mickey (my employers have changed but, the name has remained)

Index: kern/kern_malloc.c
===================================================================
RCS file: /mount/p4/cvs/openbsd/src/sys/kern/kern_malloc.c,v
retrieving revision 1.74
diff -u -r1.74 kern_malloc.c
--- kern/kern_malloc.c 21 Feb 2008 10:40:48 -0000 1.74
+++ kern/kern_malloc.c 10 Mar 2008 13:10:39 -0000
@@ -1,7 +1,7 @@
/* $OpenBSD: kern_malloc.c,v 1.74 2008/02/21 10:40:48 kettenis Exp $ */
-/* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */

/*
+ * Copyright (c) 2008 Michael Shalayeff
* Copyright (c) 1987, 1991, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -39,11 +39,12 @@
#include <sys/systm.h>
#include <sys/sysctl.h>
#include <sys/time.h>
+#include <sys/pool.h>
#include <sys/rwlock.h>

#include <uvm/uvm_extern.h>

static struct vm_map kmem_map_store;
struct vm_map *kmem_map = NULL;

#ifdef NKMEMCLUSTERS
@@ -74,6 +75,8 @@
#endif
u_int nkmempages_max = 0;

+struct pool mallocpl[MINBUCKET + 16];
+char mallocplnames[MINBUCKET + 16][8]; /* wchan for pool */
struct kmembuckets bucket[MINBUCKET + 16];
struct kmemstats kmemstats[M_LAST];
struct kmemusage *kmemusage;
@@ -133,6 +136,77 @@
struct timeval malloc_lasterr;
#endif

+void *malloc_page_alloc(struct pool *, int);
+void malloc_page_free(struct pool *, void *);
+struct pool_allocator pool_allocator_malloc = {
+ malloc_page_alloc, malloc_page_free, 0,
+};
+
+void *
+malloc_page_alloc(struct pool *pp, int flags)
+{
+#if 0
+ struct kmembuckets *kbp;
+ struct kmemusage *kup;
+ int indx;
+
+ void *v = (void *)uvm_km_kmemalloc(kmem_map, uvmexp.kmem_object,
+ PAGE_SIZE, ((flags & M_NOWAIT) ? UVM_KMF_NOWAIT : 0) |
+ ((flags & M_CANFAIL) ? UVM_KMF_CANFAIL : 0));
+
+ kup = btokup(v);
+ indx = BUCKETINDX(pp->pr_size...

Previous thread: wdc_obio at macppc: timeouting and seldom system blocks by Peter Kun on Sunday, March 23, 2008 - 12:00 pm. (1 message)

Next thread: Re: kernel/5761: improve kernel malloc by mickey on Monday, March 24, 2008 - 6:55 am. (1 message)