Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F146371135
D53160.id164598.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D53160.id164598.diff
View Options
diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c
--- a/sys/dev/random/random_harvestq.c
+++ b/sys/dev/random/random_harvestq.c
@@ -154,12 +154,6 @@
#define RANDOM_HARVEST_LOCK() mtx_lock_spin(&harvest_context.hc_mtx)
#define RANDOM_HARVEST_UNLOCK() mtx_unlock_spin(&harvest_context.hc_mtx)
-static struct kproc_desc random_proc_kp = {
- "rand_harvestq",
- random_kthread,
- &harvest_context.hc_kthread_proc,
-};
-
/* Pass the given event straight through to Fortuna/Whatever. */
static __inline void
random_harvestq_fast_process_event(struct harvest_event *event)
@@ -209,8 +203,8 @@
kproc_exit(0);
/* NOTREACHED */
}
-SYSINIT(random_device_h_proc, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, kproc_start,
- &random_proc_kp);
+KPROC_START(rand_harvestq, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, random_kthread,
+ &harvest_context.hc_kthread_proc);
_Static_assert(SI_SUB_KICK_SCHEDULER > SI_SUB_RANDOM,
"random kthread starting before subsystem initialization");
diff --git a/sys/kern/kern_alq.c b/sys/kern/kern_alq.c
--- a/sys/kern/kern_alq.c
+++ b/sys/kern/kern_alq.c
@@ -414,13 +414,9 @@
return(0);
}
-static struct kproc_desc ald_kp = {
- "ALQ Daemon",
- ald_daemon,
- &ald_proc
-};
-
-SYSINIT(aldthread, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, kproc_start, &ald_kp);
+/* FIXME the original name is "ALQ Daemon" */
+KPROC_START(alq_daemon, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, ald_daemon,
+ &ald_proc);
SYSINIT(ald, SI_SUB_LOCK, SI_ORDER_ANY, ald_startup, NULL);
/* User visible queue functions */
diff --git a/sys/kern/kern_poll.c b/sys/kern/kern_poll.c
--- a/sys/kern/kern_poll.c
+++ b/sys/kern/kern_poll.c
@@ -573,10 +573,4 @@
}
static struct proc *idlepoll;
-static struct kproc_desc idlepoll_kp = {
- "idlepoll",
- poll_idle,
- &idlepoll
-};
-SYSINIT(idlepoll, SI_SUB_KTHREAD_VM, SI_ORDER_ANY, kproc_start,
- &idlepoll_kp);
+KPROC_START(idlepoll, SI_SUB_KTHREAD_VM, SI_ORDER_ANY, poll_idle, &idlepoll);
diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -150,13 +150,7 @@
static void kick_other_cpu(int pri, int cpuid);
#endif
-static struct kproc_desc sched_kp = {
- "schedcpu",
- schedcpu_thread,
- NULL
-};
-SYSINIT(schedcpu, SI_SUB_LAST, SI_ORDER_FIRST, kproc_start,
- &sched_kp);
+KPROC_START(schedcpu, SI_SUB_LAST, SI_ORDER_FIRST, schedcpu_thread, NULL);
SYSINIT(sched_setup, SI_SUB_RUN_QUEUE, SI_ORDER_FIRST, sched_setup, NULL);
static void sched_initticks(void *dummy);
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -3408,12 +3408,8 @@
* update daemon but if it cannot keep up this process starts to
* take the load in an attempt to prevent getnewbuf() from blocking.
*/
-static struct kproc_desc buf_kp = {
- "bufdaemon",
- buf_daemon,
- &bufdaemonproc
-};
-SYSINIT(bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, kproc_start, &buf_kp);
+KPROC_START(bufdaemon, SI_SUB_KTHREAD_BUF, SI_ORDER_FIRST, buf_daemon,
+ &bufdaemonproc);
static int
buf_flush(struct vnode *vp, struct bufdomain *bd, int target)
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -1882,13 +1882,8 @@
}
}
-static struct kproc_desc vnlru_kp = {
- "vnlru",
- vnlru_proc,
- &vnlruproc
-};
-SYSINIT(vnlru, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, kproc_start,
- &vnlru_kp);
+KPROC_START(vnlru, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, vnlru_proc,
+ &vnlruproc);
/*
* Routines having to do with the management of the vnode table.
@@ -2951,12 +2946,8 @@
static struct proc *updateproc;
static void sched_sync(void);
-static struct kproc_desc up_kp = {
- "syncer",
- sched_sync,
- &updateproc
-};
-SYSINIT(syncer, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, kproc_start, &up_kp);
+KPROC_START(syncer, SI_SUB_KTHREAD_UPDATE, SI_ORDER_FIRST, sched_sync,
+ &updateproc);
static int
sync_vnode(struct synclist *slp, struct bufobj **bo, struct thread *td)
diff --git a/sys/powerpc/powermac/powermac_thermal.c b/sys/powerpc/powermac/powermac_thermal.c
--- a/sys/powerpc/powermac/powermac_thermal.c
+++ b/sys/powerpc/powermac/powermac_thermal.c
@@ -50,14 +50,8 @@
static struct proc *pmac_them_proc;
static int enable_pmac_thermal = 1;
-static struct kproc_desc pmac_therm_kp = {
- "pmac_thermal",
- fan_management_proc,
- &pmac_them_proc
-};
-
-SYSINIT(pmac_therm_setup, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, kproc_start,
- &pmac_therm_kp);
+KPROC_START(pmac_thermal, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, fan_management_proc,
+ &pmac_them_proc);
SYSCTL_INT(_machdep, OID_AUTO, manage_fans, CTLFLAG_RWTUN,
&enable_pmac_thermal, 1, "Enable automatic fan management");
static MALLOC_DEFINE(M_PMACTHERM, "pmactherm", "Powermac Thermal Management");
diff --git a/sys/powerpc/powernv/opal_dev.c b/sys/powerpc/powernv/opal_dev.c
--- a/sys/powerpc/powernv/opal_dev.c
+++ b/sys/powerpc/powernv/opal_dev.c
@@ -97,14 +97,8 @@
static void opal_handle_messages(void);
static struct proc *opal_hb_proc;
-static struct kproc_desc opal_heartbeat_kp = {
- "opal_heartbeat",
- opal_heartbeat,
- &opal_hb_proc
-};
-
-SYSINIT(opal_heartbeat_setup, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, kproc_start,
- &opal_heartbeat_kp);
+KPROC_START(opal_heartbeat, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, opal_heartbeat,
+ &opal_hb_proc);
static int opal_heartbeat_ms;
EVENTHANDLER_LIST_DEFINE(OPAL_ASYNC_COMP);
diff --git a/sys/sys/kthread.h b/sys/sys/kthread.h
--- a/sys/sys/kthread.h
+++ b/sys/sys/kthread.h
@@ -58,6 +58,14 @@
int kproc_suspend(struct proc *, int);
void kproc_suspend_check(struct proc *);
+#define KPROC_START(kname, subsystem, order, kfunc, kproc) \
+static struct kproc_desc kname ## _kproc_desc = { \
+ .arg0 = #kname, \
+ .func = kfunc, \
+ .global_procpp = kproc \
+}; \
+SYSINIT(kname, subsystem, order, kproc_start, &kname ## _kproc_desc)
+
/* create a thread in the given process. create the process if needed */
int kproc_kthread_add(void (*)(void *), void *,
struct proc **,
diff --git a/sys/vm/vm_pageout.c b/sys/vm/vm_pageout.c
--- a/sys/vm/vm_pageout.c
+++ b/sys/vm/vm_pageout.c
@@ -130,14 +130,8 @@
NULL);
struct proc *pageproc;
-
-static struct kproc_desc page_kp = {
- "pagedaemon",
- vm_pageout,
- &pageproc
-};
-SYSINIT(pagedaemon, SI_SUB_KTHREAD_PAGE, SI_ORDER_SECOND, kproc_start,
- &page_kp);
+KPROC_START(pagedaemon, SI_SUB_KTHREAD_PAGE, SI_ORDER_SECOND, vm_pageout,
+ &pageproc);
SDT_PROVIDER_DEFINE(vm);
SDT_PROBE_DEFINE(vm, , , vm__lowmem_scan);
diff --git a/sys/vm/vm_swapout.c b/sys/vm/vm_swapout.c
--- a/sys/vm/vm_swapout.c
+++ b/sys/vm/vm_swapout.c
@@ -114,13 +114,7 @@
/* the kernel process "vm_daemon" */
static void vm_daemon(void);
static struct proc *vmproc;
-
-static struct kproc_desc vm_kp = {
- "vmdaemon",
- vm_daemon,
- &vmproc
-};
-SYSINIT(vmdaemon, SI_SUB_KTHREAD_VM, SI_ORDER_FIRST, kproc_start, &vm_kp);
+KPROC_START(vmdaemon, SI_SUB_KTHREAD_VM, SI_ORDER_FIRST, vm_daemon, &vmproc);
static int vm_daemon_timeout = 0;
SYSCTL_INT(_vm, OID_AUTO, vmdaemon_timeout, CTLFLAG_RW,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 3, 4:00 AM (13 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29181792
Default Alt Text
D53160.id164598.diff (7 KB)
Attached To
Mode
D53160: kthread: Add a wrapper macro KPROC_START
Attached
Detach File
Event Timeline
Log In to Comment