From owner-svn-src-head@FreeBSD.ORG Wed May 11 21:47:31 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43EB31065673; Wed, 11 May 2011 21:47:31 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28F8F8FC13; Wed, 11 May 2011 21:47:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p4BLlV73007406; Wed, 11 May 2011 21:47:31 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4BLlVAn007404; Wed, 11 May 2011 21:47:31 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201105112147.p4BLlVAn007404@svn.freebsd.org> From: Andrew Thompson Date: Wed, 11 May 2011 21:47:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221792 - head/sys/geom X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 May 2011 21:47:31 -0000 Author: thompsa Date: Wed May 11 21:47:30 2011 New Revision: 221792 URL: http://svn.freebsd.org/changeset/base/221792 Log: Move the three geom kprocs as threads under a single pid. Reviewed by: julian Modified: head/sys/geom/geom_kern.c Modified: head/sys/geom/geom_kern.c ============================================================================== --- head/sys/geom/geom_kern.c Wed May 11 21:15:12 2011 (r221791) +++ head/sys/geom/geom_kern.c Wed May 11 21:47:30 2011 (r221792) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -57,7 +58,10 @@ MALLOC_DEFINE(M_GEOM, "GEOM", "Geom data struct sx topology_lock; -static struct proc *g_up_proc; +static struct proc *g_proc; +static struct thread *g_up_td; +static struct thread *g_down_td; +static struct thread *g_event_td; int g_debugflags; int g_collectstats = 1; @@ -82,71 +86,43 @@ int g_shutdown; */ static void -g_up_procbody(void) +g_up_procbody(void *arg) { - struct proc *p = g_up_proc; - struct thread *tp = FIRST_THREAD_IN_PROC(p); mtx_assert(&Giant, MA_NOTOWNED); - thread_lock(tp); - sched_prio(tp, PRIBIO); - thread_unlock(tp); + thread_lock(g_up_td); + sched_prio(g_up_td, PRIBIO); + thread_unlock(g_up_td); for(;;) { - g_io_schedule_up(tp); + g_io_schedule_up(g_up_td); } } -static struct kproc_desc g_up_kp = { - "g_up", - g_up_procbody, - &g_up_proc, -}; - -static struct proc *g_down_proc; - static void -g_down_procbody(void) +g_down_procbody(void *arg) { - struct proc *p = g_down_proc; - struct thread *tp = FIRST_THREAD_IN_PROC(p); mtx_assert(&Giant, MA_NOTOWNED); - thread_lock(tp); - sched_prio(tp, PRIBIO); - thread_unlock(tp); + thread_lock(g_down_td); + sched_prio(g_down_td, PRIBIO); + thread_unlock(g_down_td); for(;;) { - g_io_schedule_down(tp); + g_io_schedule_down(g_down_td); } } -static struct kproc_desc g_down_kp = { - "g_down", - g_down_procbody, - &g_down_proc, -}; - -static struct proc *g_event_proc; - static void -g_event_procbody(void) +g_event_procbody(void *arg) { - struct proc *p = g_event_proc; - struct thread *tp = FIRST_THREAD_IN_PROC(p); mtx_assert(&Giant, MA_NOTOWNED); - thread_lock(tp); - sched_prio(tp, PRIBIO); - thread_unlock(tp); + thread_lock(g_event_td); + sched_prio(g_event_td, PRIBIO); + thread_unlock(g_event_td); g_run_events(); /* NOTREACHED */ } -static struct kproc_desc g_event_kp = { - "g_event", - g_event_procbody, - &g_event_proc, -}; - static void geom_shutdown(void *foo __unused) { @@ -164,9 +140,12 @@ g_init(void) g_event_init(); g_ctl_init(); mtx_lock(&Giant); - kproc_start(&g_event_kp); - kproc_start(&g_up_kp); - kproc_start(&g_down_kp); + kproc_kthread_add(g_event_procbody, NULL, &g_proc, &g_event_td, + RFHIGHPID, 0, "geom", "g_event"); + kproc_kthread_add(g_up_procbody, NULL, &g_proc, &g_up_td, + RFHIGHPID, 0, "geom", "g_up"); + kproc_kthread_add(g_down_procbody, NULL, &g_proc, &g_down_td, + RFHIGHPID, 0, "geom", "g_down"); mtx_unlock(&Giant); EVENTHANDLER_REGISTER(shutdown_pre_sync, geom_shutdown, NULL, SHUTDOWN_PRI_FIRST);