Page MenuHomeFreeBSD

D4999.id12485.diff
No OneTemporary

D4999.id12485.diff

Index: sys/kern/vfs_aio.c
===================================================================
--- sys/kern/vfs_aio.c
+++ sys/kern/vfs_aio.c
@@ -130,12 +130,12 @@
static int max_aio_procs = MAX_AIO_PROCS;
SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_procs,
CTLFLAG_RW, &max_aio_procs, 0,
- "Maximum number of kernel threads to use for handling async IO ");
+ "Maximum number of kernel processes to use for handling async IO ");
static int num_aio_procs = 0;
SYSCTL_INT(_vfs_aio, OID_AUTO, num_aio_procs,
CTLFLAG_RD, &num_aio_procs, 0,
- "Number of presently active kernel threads for async IO");
+ "Number of presently active kernel processes for async IO");
/*
* The code will adjust the actual number of AIO processes towards this
@@ -143,7 +143,7 @@
*/
static int target_aio_procs = TARGET_AIO_PROCS;
SYSCTL_INT(_vfs_aio, OID_AUTO, target_aio_procs, CTLFLAG_RW, &target_aio_procs,
- 0, "Preferred number of ready kernel threads for async IO");
+ 0, "Preferred number of ready kernel processes for async IO");
static int max_queue_count = MAX_AIO_QUEUE;
SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_queue, CTLFLAG_RW, &max_queue_count, 0,
@@ -157,7 +157,7 @@
SYSCTL_INT(_vfs_aio, OID_AUTO, num_buf_aio, CTLFLAG_RD, &num_buf_aio, 0,
"Number of aio requests presently handled by the buf subsystem");
-/* Number of async I/O thread in the process of being started */
+/* Number of async I/O processes in the process of being started */
/* XXX This should be local to aio_aqueue() */
static int num_aio_resv_start = 0;
@@ -210,8 +210,8 @@
* Current, there is only two backends: BIO and generic file I/O.
* socket I/O is served by generic file I/O, this is not a good idea, since
* disk file I/O and any other types without O_NONBLOCK flag can block daemon
- * threads, if there is no thread to serve socket I/O, the socket I/O will be
- * delayed too long or starved, we should create some threads dedicated to
+ * processes, if there is no thread to serve socket I/O, the socket I/O will be
+ * delayed too long or starved, we should create some processes dedicated to
* sockets to do non-blocking I/O, same for pipe and fifo, for these I/O
* systems we really need non-blocking interface, fiddling O_NONBLOCK in file
* structure is not safe because there is race between userland and aio
@@ -253,10 +253,10 @@
*/
#define AIOP_FREE 0x1 /* proc on free queue */
-struct aiothreadlist {
- int aiothreadflags; /* (c) AIO proc flags */
- TAILQ_ENTRY(aiothreadlist) list; /* (c) list of processes */
- struct thread *aiothread; /* (*) the AIO thread */
+struct aioproc {
+ int aioprocflags; /* (c) AIO proc flags */
+ TAILQ_ENTRY(aioproc) list; /* (c) list of processes */
+ struct proc *aioproc; /* (*) the AIO proc */
};
/*
@@ -297,7 +297,7 @@
* NOT USED YET.
*/
TAILQ_HEAD(,aiocblist) kaio_syncqueue; /* (a) queue for aio_fsync */
- struct task kaio_task; /* (*) task to kick aio threads */
+ struct task kaio_task; /* (*) task to kick aio processes */
};
#define AIO_LOCK(ki) mtx_lock(&(ki)->kaio_mtx)
@@ -322,7 +322,7 @@
int (*store_aiocb)(struct aiocb **ujobp, struct aiocb *ujob);
};
-static TAILQ_HEAD(,aiothreadlist) aio_freeproc; /* (c) Idle daemons */
+static TAILQ_HEAD(,aioproc) aio_freeproc; /* (c) Idle daemons */
static struct sema aio_newproc_sem;
static struct mtx aio_job_mtx;
static struct mtx aio_sock_mtx;
@@ -361,7 +361,7 @@
/*
* Zones for:
* kaio Per process async io info
- * aiop async io thread data
+ * aiop async io process data
* aiocb async io jobs
* aiol list io job pointer - internal to aio_suspend XXX
* aiolio list io jobs
@@ -488,7 +488,7 @@
aiod_unr = new_unrhdr(1, INT_MAX, NULL);
kaio_zone = uma_zcreate("AIO", sizeof(struct kaioinfo), NULL, NULL,
NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
- aiop_zone = uma_zcreate("AIOP", sizeof(struct aiothreadlist), NULL,
+ aiop_zone = uma_zcreate("AIOP", sizeof(struct aioproc), NULL,
NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
aiocb_zone = uma_zcreate("AIOCB", sizeof(struct aiocblist), NULL, NULL,
NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
@@ -803,7 +803,7 @@
* Select a job to run (called by an AIO daemon).
*/
static struct aiocblist *
-aio_selectjob(struct aiothreadlist *aiop)
+aio_selectjob(struct aioproc *aiop)
{
struct aiocblist *aiocbe;
struct kaioinfo *ki;
@@ -1063,7 +1063,7 @@
aio_daemon(void *_id)
{
struct aiocblist *aiocbe;
- struct aiothreadlist *aiop;
+ struct aioproc *aiop;
struct kaioinfo *ki;
struct proc *p, *userp;
struct vmspace *myvm;
@@ -1085,8 +1085,8 @@
* per daemon.
*/
aiop = uma_zalloc(aiop_zone, M_WAITOK);
- aiop->aiothread = td;
- aiop->aiothreadflags = 0;
+ aiop->aioproc = p;
+ aiop->aioprocflags = 0;
/*
* Wakeup parent process. (Parent sleeps to keep from blasting away
@@ -1099,9 +1099,9 @@
/*
* Take daemon off of free queue
*/
- if (aiop->aiothreadflags & AIOP_FREE) {
+ if (aiop->aioprocflags & AIOP_FREE) {
TAILQ_REMOVE(&aio_freeproc, aiop, list);
- aiop->aiothreadflags &= ~AIOP_FREE;
+ aiop->aioprocflags &= ~AIOP_FREE;
}
/*
@@ -1162,15 +1162,15 @@
mtx_assert(&aio_job_mtx, MA_OWNED);
TAILQ_INSERT_HEAD(&aio_freeproc, aiop, list);
- aiop->aiothreadflags |= AIOP_FREE;
+ aiop->aioprocflags |= AIOP_FREE;
/*
* If daemon is inactive for a long time, allow it to exit,
* thereby freeing resources.
*/
- if (msleep(aiop->aiothread, &aio_job_mtx, PRIBIO, "aiordy",
+ if (msleep(p, &aio_job_mtx, PRIBIO, "aiordy",
aiod_lifetime) == EWOULDBLOCK && TAILQ_EMPTY(&aio_jobs) &&
- (aiop->aiothreadflags & AIOP_FREE) &&
+ (aiop->aioprocflags & AIOP_FREE) &&
num_aio_procs > target_aio_procs)
break;
}
@@ -1788,13 +1788,13 @@
aio_kick_nowait(struct proc *userp)
{
struct kaioinfo *ki = userp->p_aioinfo;
- struct aiothreadlist *aiop;
+ struct aioproc *aiop;
mtx_assert(&aio_job_mtx, MA_OWNED);
if ((aiop = TAILQ_FIRST(&aio_freeproc)) != NULL) {
TAILQ_REMOVE(&aio_freeproc, aiop, list);
- aiop->aiothreadflags &= ~AIOP_FREE;
- wakeup(aiop->aiothread);
+ aiop->aioprocflags &= ~AIOP_FREE;
+ wakeup(aiop->aioproc);
} else if (((num_aio_resv_start + num_aio_procs) < max_aio_procs) &&
((ki->kaio_active_count + num_aio_resv_start) <
ki->kaio_maxactive_count)) {
@@ -1806,15 +1806,15 @@
aio_kick(struct proc *userp)
{
struct kaioinfo *ki = userp->p_aioinfo;
- struct aiothreadlist *aiop;
+ struct aioproc *aiop;
int error, ret = 0;
mtx_assert(&aio_job_mtx, MA_OWNED);
retryproc:
if ((aiop = TAILQ_FIRST(&aio_freeproc)) != NULL) {
TAILQ_REMOVE(&aio_freeproc, aiop, list);
- aiop->aiothreadflags &= ~AIOP_FREE;
- wakeup(aiop->aiothread);
+ aiop->aioprocflags &= ~AIOP_FREE;
+ wakeup(aiop->aioproc);
} else if (((num_aio_resv_start + num_aio_procs) < max_aio_procs) &&
((ki->kaio_active_count + num_aio_resv_start) <
ki->kaio_maxactive_count)) {

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 15, 3:38 PM (2 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29711243
Default Alt Text
D4999.id12485.diff (6 KB)

Event Timeline