From fbab5b6cdee93fd0818b09c6201db020bd35a0fd Mon Sep 17 00:00:00 2001 From: tedu Date: Fri, 19 Dec 2014 05:59:21 +0000 Subject: [PATCH] start retiring the nointr allocator. specify PR_WAITOK as a flag as a marker for which pools are not interrupt safe. ok dlg --- sys/kern/kern_descrip.c | 10 +++++----- sys/kern/kern_event.c | 10 +++++----- sys/kern/kern_proc.c | 26 +++++++++++++------------- sys/kern/kern_resource.c | 6 +++--- sys/kern/kern_sig.c | 6 +++--- sys/kern/sys_pipe.c | 6 +++--- sys/kern/sysv_msg.c | 6 +++--- sys/kern/sysv_sem.c | 9 ++++----- sys/kern/sysv_shm.c | 5 ++--- sys/kern/vfs_cache.c | 6 +++--- sys/kern/vfs_init.c | 5 ++--- sys/kern/vfs_lockf.c | 6 +++--- sys/kern/vfs_subr.c | 10 +++++----- 13 files changed, 54 insertions(+), 57 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index b3acaff6acd..fae56136380 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.114 2014/12/16 18:30:03 tedu Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.115 2014/12/19 05:59:21 tedu Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -83,10 +83,10 @@ struct pool fdesc_pool; void filedesc_init(void) { - pool_init(&file_pool, sizeof(struct file), 0, 0, 0, "filepl", - &pool_allocator_nointr); - pool_init(&fdesc_pool, sizeof(struct filedesc0), 0, 0, 0, "fdescpl", - &pool_allocator_nointr); + pool_init(&file_pool, sizeof(struct file), 0, 0, PR_WAITOK, + "filepl", NULL); + pool_init(&fdesc_pool, sizeof(struct filedesc0), 0, 0, PR_WAITOK, + "fdescpl", NULL); LIST_INIT(&filehead); } diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 691aa9ca61a..a6db9983069 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.60 2014/12/09 07:05:06 doug Exp $ */ +/* $OpenBSD: kern_event.c,v 1.61 2014/12/19 05:59:21 tedu Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon @@ -162,10 +162,10 @@ void kqueue_init(void) { - pool_init(&kqueue_pool, sizeof(struct kqueue), 0, 0, 0, "kqueuepl", - &pool_allocator_nointr); - pool_init(&knote_pool, sizeof(struct knote), 0, 0, 0, "knotepl", - &pool_allocator_nointr); + pool_init(&kqueue_pool, sizeof(struct kqueue), 0, 0, PR_WAITOK, + "kqueuepl", NULL); + pool_init(&knote_pool, sizeof(struct knote), 0, 0, PR_WAITOK, + "knotepl", NULL); } int diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 26a2c1a7116..87fc1017a08 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_proc.c,v 1.62 2014/12/10 02:44:47 tedu Exp $ */ +/* $OpenBSD: kern_proc.c,v 1.63 2014/12/19 05:59:21 tedu Exp $ */ /* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */ /* @@ -93,18 +93,18 @@ procinit(void) if (!pidhashtbl || !pgrphashtbl || !uihashtbl) panic("procinit: malloc"); - pool_init(&proc_pool, sizeof(struct proc), 0, 0, 0, "procpl", - &pool_allocator_nointr); - pool_init(&process_pool, sizeof(struct process), 0, 0, 0, "processpl", - &pool_allocator_nointr); - pool_init(&rusage_pool, sizeof(struct rusage), 0, 0, 0, "zombiepl", - &pool_allocator_nointr); - pool_init(&ucred_pool, sizeof(struct ucred), 0, 0, 0, "ucredpl", - &pool_allocator_nointr); - pool_init(&pgrp_pool, sizeof(struct pgrp), 0, 0, 0, "pgrppl", - &pool_allocator_nointr); - pool_init(&session_pool, sizeof(struct session), 0, 0, 0, "sessionpl", - &pool_allocator_nointr); + pool_init(&proc_pool, sizeof(struct proc), 0, 0, PR_WAITOK, + "procpl", NULL); + pool_init(&process_pool, sizeof(struct process), 0, 0, PR_WAITOK, + "processpl", NULL); + pool_init(&rusage_pool, sizeof(struct rusage), 0, 0, PR_WAITOK, + "zombiepl", NULL); + pool_init(&ucred_pool, sizeof(struct ucred), 0, 0, PR_WAITOK, + "ucredpl", NULL); + pool_init(&pgrp_pool, sizeof(struct pgrp), 0, 0, PR_WAITOK, + "pgrppl", NULL); + pool_init(&session_pool, sizeof(struct session), 0, 0, PR_WAITOK, + "sessionpl", NULL); } struct uidinfo * diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 4765850002b..29b8b089e04 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_resource.c,v 1.52 2014/12/10 02:44:47 tedu Exp $ */ +/* $OpenBSD: kern_resource.c,v 1.53 2014/12/19 05:59:21 tedu Exp $ */ /* $NetBSD: kern_resource.c,v 1.38 1996/10/23 07:19:38 matthias Exp $ */ /*- @@ -505,8 +505,8 @@ limcopy(struct plimit *lim) static int initialized; if (!initialized) { - pool_init(&plimit_pool, sizeof(struct plimit), 0, 0, 0, - "plimitpl", &pool_allocator_nointr); + pool_init(&plimit_pool, sizeof(struct plimit), 0, 0, PR_WAITOK, + "plimitpl", NULL); initialized = 1; } diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index bd6d1dcdba4..dfbab676fd4 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.176 2014/12/16 18:30:04 tedu Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.177 2014/12/19 05:59:21 tedu Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -147,8 +147,8 @@ signal_init(void) { timeout_set(&proc_stop_to, proc_stop_sweep, NULL); - pool_init(&sigacts_pool, sizeof(struct sigacts), 0, 0, 0, "sigapl", - &pool_allocator_nointr); + pool_init(&sigacts_pool, sizeof(struct sigacts), 0, 0, PR_WAITOK, + "sigapl", NULL); } /* diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 0fff90220e8..0f505c2cb2d 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.67 2014/09/28 18:52:04 kettenis Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.68 2014/12/19 05:59:21 tedu Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -876,7 +876,7 @@ filt_pipewrite(struct knote *kn, long hint) void pipe_init(void) { - pool_init(&pipe_pool, sizeof(struct pipe), 0, 0, 0, "pipepl", - &pool_allocator_nointr); + pool_init(&pipe_pool, sizeof(struct pipe), 0, 0, PR_WAITOK, "pipepl", + NULL); } diff --git a/sys/kern/sysv_msg.c b/sys/kern/sysv_msg.c index 8c1aafcf469..bfad640ad08 100644 --- a/sys/kern/sysv_msg.c +++ b/sys/kern/sysv_msg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_msg.c,v 1.29 2014/12/10 02:44:47 tedu Exp $ */ +/* $OpenBSD: sysv_msg.c,v 1.30 2014/12/19 05:59:21 tedu Exp $ */ /* $NetBSD: sysv_msg.c,v 1.19 1996/02/09 19:00:18 christos Exp $ */ /* * Copyright (c) 2009 Bret S. Lambert @@ -80,8 +80,8 @@ msginit(void) msginfo.msgssz = MSGSSZ; msginfo.msgseg = MSGSEG; - pool_init(&sysvmsgpl, sizeof(struct msg), 0, 0, 0, "sysvmsgpl", - &pool_allocator_nointr); + pool_init(&sysvmsgpl, sizeof(struct msg), 0, 0, PR_WAITOK, "sysvmsgpl", + NULL); TAILQ_INIT(&msg_queues); diff --git a/sys/kern/sysv_sem.c b/sys/kern/sysv_sem.c index 1e579776f4f..ca1325f0130 100644 --- a/sys/kern/sysv_sem.c +++ b/sys/kern/sysv_sem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_sem.c,v 1.51 2014/12/10 02:44:47 tedu Exp $ */ +/* $OpenBSD: sysv_sem.c,v 1.52 2014/12/19 05:59:21 tedu Exp $ */ /* $NetBSD: sysv_sem.c,v 1.26 1996/02/09 19:00:25 christos Exp $ */ /* @@ -62,10 +62,9 @@ void seminit(void) { - pool_init(&sema_pool, sizeof(struct semid_ds), 0, 0, 0, "semapl", - &pool_allocator_nointr); - pool_init(&semu_pool, SEMUSZ, 0, 0, 0, "semupl", - &pool_allocator_nointr); + pool_init(&sema_pool, sizeof(struct semid_ds), 0, 0, PR_WAITOK, + "semapl", NULL); + pool_init(&semu_pool, SEMUSZ, 0, 0, PR_WAITOK, "semupl", NULL); sema = mallocarray(seminfo.semmni, sizeof(struct semid_ds *), M_SEM, M_WAITOK|M_ZERO); semseqs = mallocarray(seminfo.semmni, sizeof(unsigned short), diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 2b323c7929c..8584004b3cd 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_shm.c,v 1.63 2014/12/17 06:58:11 guenther Exp $ */ +/* $OpenBSD: sysv_shm.c,v 1.64 2014/12/19 05:59:21 tedu Exp $ */ /* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */ /* @@ -526,8 +526,7 @@ shminit(void) { pool_init(&shm_pool, sizeof(struct shmid_ds) + - sizeof(struct shm_handle), 0, 0, 0, "shmpl", - &pool_allocator_nointr); + sizeof(struct shm_handle), 0, 0, PR_WAITOK, "shmpl", NULL); shmsegs = mallocarray(shminfo.shmmni, sizeof(struct shmid_ds *), M_SHM, M_WAITOK|M_ZERO); shmseqs = mallocarray(shminfo.shmmni, sizeof(unsigned short), diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index cda6f7af431..ceceb9098bf 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_cache.c,v 1.39 2014/12/16 18:30:04 tedu Exp $ */ +/* $OpenBSD: vfs_cache.c,v 1.40 2014/12/19 05:59:21 tedu Exp $ */ /* $NetBSD: vfs_cache.c,v 1.13 1996/02/04 02:18:09 christos Exp $ */ /* @@ -418,8 +418,8 @@ nchinit() { TAILQ_INIT(&nclruhead); TAILQ_INIT(&nclruneghead); - pool_init(&nch_pool, sizeof(struct namecache), 0, 0, 0, "nchpl", - &pool_allocator_nointr); + pool_init(&nch_pool, sizeof(struct namecache), 0, 0, PR_WAITOK, + "nchpl", NULL); } /* diff --git a/sys/kern/vfs_init.c b/sys/kern/vfs_init.c index dd2afbbb810..02a58dc7924 100644 --- a/sys/kern/vfs_init.c +++ b/sys/kern/vfs_init.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_init.c,v 1.34 2014/09/08 01:47:06 guenther Exp $ */ +/* $OpenBSD: vfs_init.c,v 1.35 2014/12/19 05:59:21 tedu Exp $ */ /* $NetBSD: vfs_init.c,v 1.6 1996/02/09 19:00:58 christos Exp $ */ /* @@ -149,8 +149,7 @@ vfsinit(void) struct vfsconf *vfsconflist; int vfsconflistlen; - pool_init(&namei_pool, MAXPATHLEN, 0, 0, 0, "namei", - &pool_allocator_nointr); + pool_init(&namei_pool, MAXPATHLEN, 0, 0, PR_WAITOK, "namei", NULL); /* Initialize the vnode table. */ vntblinit(); diff --git a/sys/kern/vfs_lockf.c b/sys/kern/vfs_lockf.c index dccf3cb2b54..91db278f1d5 100644 --- a/sys/kern/vfs_lockf.c +++ b/sys/kern/vfs_lockf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_lockf.c,v 1.18 2014/11/03 21:28:35 tedu Exp $ */ +/* $OpenBSD: vfs_lockf.c,v 1.19 2014/12/19 05:59:21 tedu Exp $ */ /* $NetBSD: vfs_lockf.c,v 1.7 1996/02/04 02:18:21 christos Exp $ */ /* @@ -76,8 +76,8 @@ int lockf_debug = DEBUG_SETLOCK|DEBUG_CLEARLOCK|DEBUG_WAKELOCK; void lf_init(void) { - pool_init(&lockfpool, sizeof(struct lockf), 0, 0, 0, - "lockfpl", &pool_allocator_nointr); + pool_init(&lockfpool, sizeof(struct lockf), 0, 0, PR_WAITOK, + "lockfpl", NULL); } struct lockf *lf_alloc(uid_t, int); diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 225e0a89c8e..0f9fd976928 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.226 2014/12/17 19:42:15 tedu Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.227 2014/12/19 05:59:21 tedu Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -143,10 +143,10 @@ vntblinit(void) { /* buffer cache may need a vnode for each buffer */ maxvnodes = 2 * desiredvnodes; - pool_init(&vnode_pool, sizeof(struct vnode), 0, 0, 0, "vnodes", - &pool_allocator_nointr); - pool_init(&uvm_vnode_pool, sizeof(struct uvm_vnode), 0, 0, 0, "uvmvnodes", - &pool_allocator_nointr); + pool_init(&vnode_pool, sizeof(struct vnode), 0, 0, PR_WAITOK, + "vnodes", NULL); + pool_init(&uvm_vnode_pool, sizeof(struct uvm_vnode), 0, 0, PR_WAITOK, + "uvmvnodes", NULL); TAILQ_INIT(&vnode_hold_list); TAILQ_INIT(&vnode_free_list); TAILQ_INIT(&mountlist); -- 2.20.1