Subject: Re: kern/13232: POOL_DIAGNOSTIC && pool.h
To: None <sommerfeld@orchard.arlington.ma.us>
From: Assar Westerlund <assar@netbsd.org>
List: tech-kern
Date: 06/19/2001 22:40:12
Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us> writes:
> they may be ignored in the called routine, but the caller still has to
> load up argument registers / push arguments containing them; that's
> where the performance hit was..
> 
> pool_get is called *VERY* frequently.

How about making just LKMs pay that price, as in this patch?  I cannot
see how you could make LKMs that do not have to be different for
POOL_DIAGNOSTIC and non-POOL_DIAGNOSTIC kernels otherwise.

/assar

Index: kern/subr_pool.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/subr_pool.c,v
retrieving revision 1.59
diff -u -w -r1.59 subr_pool.c
--- kern/subr_pool.c	2001/06/05 18:51:04	1.59
+++ kern/subr_pool.c	2001/06/19 20:38:07
@@ -572,6 +572,14 @@
 	return (ph);
 }
 
+#ifndef POOL_DIAGNOSTIC
+void *
+_pool_get(struct pool *pp, int flags, const char *file, long line)
+{
+	return pool_get(pp, flags);
+}
+#endif /* POOL_DIAGNOSTIC */
+
 /*
  * Grab an item from the pool; must be called at appropriate spl level
  */
@@ -943,6 +951,14 @@
 	}
 }
 
+#ifndef POOL_DIAGNOSTIC
+void
+_pool_put(struct pool *pp, void *v, const char *file, long line)
+{
+	return pool_put(pp, v);
+}
+#endif /* POOL_DIAGNOSTIC */
+
 /*
  * Return resource to the pool; must be called at appropriate spl level
  */
@@ -1244,6 +1260,13 @@
 	uvm_km_free_poolpage1(kernel_map, (vaddr_t)v);
 }
 
+#ifndef POOL_DIAGNOSTIC
+void
+_pool_reclaim(struct pool *pp, const char *file, long line)
+{
+	return pool_reclaim(pp);
+}
+#endif /* POOL_DIAGNOSTIC */
 
 /*
  * Release all complete pages that have not been used recently.
Index: sys/pool.h
===================================================================
RCS file: /cvsroot/syssrc/sys/sys/pool.h,v
retrieving revision 1.27
diff -u -w -r1.27 pool.h
--- sys/pool.h	2001/06/06 22:00:17	1.27
+++ sys/pool.h	2001/06/19 20:38:07
@@ -184,13 +184,13 @@
 void		pool_put(struct pool *, void *);
 void		pool_reclaim(struct pool *);
 
-#ifdef POOL_DIAGNOSTIC
-/*
- * These versions do reentrancy checking.
- */
 void		*_pool_get(struct pool *, int, const char *, long);
 void		_pool_put(struct pool *, void *, const char *, long);
 void		_pool_reclaim(struct pool *, const char *, long);
+/*
+ * These versions do reentrancy checking.
+ */
+#if defined(POOL_DIAGNOSTIC) || defined(_LKM)
 #define		pool_get(h, f)	_pool_get((h), (f), __FILE__, __LINE__)
 #define		pool_put(h, v)	_pool_put((h), (v), __FILE__, __LINE__)
 #define		pool_reclaim(h)	_pool_reclaim((h), __FILE__, __LINE__)