svn commit: r328582 - stable/11/sys/kern
John Baldwin
jhb at FreeBSD.org
Tue Jan 30 00:52:23 UTC 2018
Author: jhb
Date: Tue Jan 30 00:52:22 2018
New Revision: 328582
URL: https://svnweb.freebsd.org/changeset/base/328582
Log:
MFC 327792: Don't store shadow copies of per-process AIO limits.
Previously the AIO subsystem would save a snapshot of the currently
configured per-process limits the first time a process used AIO. The
process would continue to use the snapshotted limits ignoring any
changes to the global limits during the rest of its lifetime. This
change removes the snapshotted values and changes the AIO code to
always check the global values which can be toggled at runtime.
This means an administrator can now change the effective limits of
existing processes. This is more consistent with how other limits
configured via sysctl work in FreeBSD.
Sponsored by: Chelsio Communications
Modified:
stable/11/sys/kern/vfs_aio.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/sys/kern/vfs_aio.c
==============================================================================
--- stable/11/sys/kern/vfs_aio.c Tue Jan 30 00:41:54 2018 (r328581)
+++ stable/11/sys/kern/vfs_aio.c Tue Jan 30 00:52:22 2018 (r328582)
@@ -164,16 +164,16 @@ SYSCTL_INT(_vfs_aio, OID_AUTO, aiod_lifetime, CTLFLAG_
static int max_aio_per_proc = MAX_AIO_PER_PROC;
SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_per_proc, CTLFLAG_RW, &max_aio_per_proc,
0,
- "Maximum active aio requests per process (stored in the process)");
+ "Maximum active aio requests per process");
static int max_aio_queue_per_proc = MAX_AIO_QUEUE_PER_PROC;
SYSCTL_INT(_vfs_aio, OID_AUTO, max_aio_queue_per_proc, CTLFLAG_RW,
&max_aio_queue_per_proc, 0,
- "Maximum queued aio requests per process (stored in the process)");
+ "Maximum queued aio requests per process");
static int max_buf_aio = MAX_BUF_AIO;
SYSCTL_INT(_vfs_aio, OID_AUTO, max_buf_aio, CTLFLAG_RW, &max_buf_aio, 0,
- "Maximum buf aio requests per process (stored in the process)");
+ "Maximum buf aio requests per process");
/*
* Though redundant with vfs.aio.max_aio_queue_per_proc, POSIX requires
@@ -266,11 +266,8 @@ struct aioliojob {
struct kaioinfo {
struct mtx kaio_mtx; /* the lock to protect this struct */
int kaio_flags; /* (a) per process kaio flags */
- int kaio_maxactive_count; /* (*) maximum number of AIOs */
int kaio_active_count; /* (c) number of currently used AIOs */
- int kaio_qallowed_count; /* (*) maxiumu size of AIO queue */
int kaio_count; /* (a) size of AIO queue */
- int kaio_ballowed_count; /* (*) maximum number of buffers */
int kaio_buffer_count; /* (a) number of physio buffers */
TAILQ_HEAD(,kaiocb) kaio_all; /* (a) all AIOs in a process */
TAILQ_HEAD(,kaiocb) kaio_done; /* (a) done queue for process */
@@ -443,11 +440,8 @@ aio_init_aioinfo(struct proc *p)
ki = uma_zalloc(kaio_zone, M_WAITOK);
mtx_init(&ki->kaio_mtx, "aiomtx", NULL, MTX_DEF | MTX_NEW);
ki->kaio_flags = 0;
- ki->kaio_maxactive_count = max_aio_per_proc;
ki->kaio_active_count = 0;
- ki->kaio_qallowed_count = max_aio_queue_per_proc;
ki->kaio_count = 0;
- ki->kaio_ballowed_count = max_buf_aio;
ki->kaio_buffer_count = 0;
TAILQ_INIT(&ki->kaio_all);
TAILQ_INIT(&ki->kaio_done);
@@ -706,7 +700,7 @@ restart:
userp = job->userproc;
ki = userp->p_aioinfo;
- if (ki->kaio_active_count < ki->kaio_maxactive_count) {
+ if (ki->kaio_active_count < max_aio_per_proc) {
TAILQ_REMOVE(&aio_jobs, job, list);
if (!aio_clear_cancel_function(job))
goto restart;
@@ -1270,7 +1264,7 @@ aio_qphysio(struct proc *p, struct kaiocb *job)
error = -1;
goto unref;
}
- if (ki->kaio_buffer_count >= ki->kaio_ballowed_count) {
+ if (ki->kaio_buffer_count >= max_buf_aio) {
error = EAGAIN;
goto unref;
}
@@ -1479,7 +1473,7 @@ aio_aqueue(struct thread *td, struct aiocb *ujob, stru
ops->store_kernelinfo(ujob, -1);
if (num_queue_count >= max_queue_count ||
- ki->kaio_count >= ki->kaio_qallowed_count) {
+ ki->kaio_count >= max_aio_queue_per_proc) {
ops->store_error(ujob, EAGAIN);
return (EAGAIN);
}
@@ -1776,8 +1770,7 @@ aio_kick_nowait(struct proc *userp)
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) {
+ ki->kaio_active_count + num_aio_resv_start < max_aio_per_proc) {
taskqueue_enqueue(taskqueue_aiod_kick, &ki->kaio_task);
}
}
@@ -1796,8 +1789,7 @@ retryproc:
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) {
+ ki->kaio_active_count + num_aio_resv_start < max_aio_per_proc) {
num_aio_resv_start++;
mtx_unlock(&aio_job_mtx);
error = aio_newproc(&num_aio_resv_start);
More information about the svn-src-all
mailing list