Module Name:    src
Committed By:   chs
Date:           Sat Dec  7 23:15:38 UTC 2024

Modified Files:
        src/sys/kern: subr_pool.c

Log Message:
pool: use "big" (ie. > PAGE_SIZE) default allocators for more cases

When I added the default "big" pool allocators back in 2017,
I added them only for pool_caches and not plain pools, and only for
IPL_NONE pool_caches at that.  But these allocators work fine for
for all pool caches and plain pools as well, so use them automatically
by default when needed for all of those cases.


To generate a diff of this commit:
cvs rdiff -u -r1.290 -r1.291 src/sys/kern/subr_pool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.290 src/sys/kern/subr_pool.c:1.291
--- src/sys/kern/subr_pool.c:1.290	Sun Apr  9 12:21:59 2023
+++ src/sys/kern/subr_pool.c	Sat Dec  7 23:15:38 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.290 2023/04/09 12:21:59 riastradh Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.291 2024/12/07 23:15:38 chs Exp $	*/
 
 /*
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015, 2018,
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.290 2023/04/09 12:21:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.291 2024/12/07 23:15:38 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -830,8 +830,18 @@ pool_init(struct pool *pp, size_t size, 
 		mutex_exit(&pool_head_lock);
 #endif
 
-	if (palloc == NULL)
-		palloc = &pool_allocator_kmem;
+	if (palloc == NULL) {
+		if (size > PAGE_SIZE) {
+			int bigidx = pool_bigidx(size);
+
+			palloc = &pool_allocator_big[bigidx];
+			flags |= PR_NOALIGN;
+		} else if (ipl == IPL_NONE) {
+			palloc = &pool_allocator_nointr;
+		} else {
+			palloc = &pool_allocator_kmem;
+		}
+	}
 
 	if (!cold)
 		mutex_enter(&pool_allocator_lock);
@@ -2115,16 +2125,6 @@ pool_cache_bootstrap(pool_cache_t pc, si
 	unsigned int ppflags;
 
 	pp = &pc->pc_pool;
-	if (palloc == NULL && ipl == IPL_NONE) {
-		if (size > PAGE_SIZE) {
-			int bigidx = pool_bigidx(size);
-
-			palloc = &pool_allocator_big[bigidx];
-			flags |= PR_NOALIGN;
-		} else
-			palloc = &pool_allocator_nointr;
-	}
-
 	ppflags = flags;
 	if (ctor == NULL) {
 		ctor = NO_CTOR;

Reply via email to