Index: sys/kern/posix4_mib.c =================================================================== --- sys/kern/posix4_mib.c +++ sys/kern/posix4_mib.c @@ -62,6 +62,10 @@ #define P1B_SYSCTL_RW(num, name) \ SYSCTL_PROC(_p1003_1b, num, name, CTLTYPE_INT | CTLFLAG_RW, NULL, num, \ p31b_sysctl_proc, "I", ""); +#define P1B_SYSCTL_TUN(num, name) \ + int * name = facility + num - 1; \ + SYSCTL_INT(_p1003_1b, num, name, CTLFLAG_RDTUN | CTLFLAG_CAPRD, \ + facility + num - 1, 0, ""); #else @@ -91,7 +95,7 @@ P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects); P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io); P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers); -P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max); +P1B_SYSCTL_TUN(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max); P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max); P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max); P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max); Index: sys/kern/vfs_aio.c =================================================================== --- sys/kern/vfs_aio.c +++ sys/kern/vfs_aio.c @@ -387,7 +387,17 @@ static int aio_onceonly(void) { + int aio_listio_max; + aio_listio_max = p31b_getcfg(CTL_P1003_1B_AIO_LISTIO_MAX); + /* Sanitize the range of aio_listio_max */ + if (aio_listio_max < AIO_LISTIO_MAX) + p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, AIO_LISTIO_MAX); + if (aio_listio_max > MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count)) + p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, + MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count)); + aio_listio_max = p31b_getcfg(CTL_P1003_1B_AIO_LISTIO_MAX); + exit_tag = EVENTHANDLER_REGISTER(process_exit, aio_proc_rundown, NULL, EVENTHANDLER_PRI_ANY); exec_tag = EVENTHANDLER_REGISTER(process_exec, aio_proc_rundown_exec, @@ -405,14 +415,13 @@ NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiocb_zone = uma_zcreate("AIOCB", sizeof(struct kaiocb), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - aiol_zone = uma_zcreate("AIOL", AIO_LISTIO_MAX*sizeof(intptr_t) , NULL, + aiol_zone = uma_zcreate("AIOL", aio_listio_max*sizeof(intptr_t) , NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiolio_zone = uma_zcreate("AIOLIO", sizeof(struct aioliojob), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); aiod_lifetime = AIOD_LIFETIME_DEFAULT; jobrefid = 1; p31b_setcfg(CTL_P1003_1B_ASYNCHRONOUS_IO, _POSIX_ASYNCHRONOUS_IO); - p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, AIO_LISTIO_MAX); p31b_setcfg(CTL_P1003_1B_AIO_MAX, MAX_AIO_QUEUE); p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, 0); @@ -1941,9 +1950,10 @@ { struct timespec ts, *tsp; struct aiocb **ujoblist; - int error; + int aio_listio_max, error; - if (uap->nent < 0 || uap->nent > AIO_LISTIO_MAX) + aio_listio_max = p31b_getcfg(CTL_P1003_1B_AIO_LISTIO_MAX); + if (uap->nent < 0 || uap->nent > aio_listio_max) return (EINVAL); if (uap->timeout) { @@ -2146,12 +2156,14 @@ struct kevent kev; int error; int nerror; - int i; + int i, aio_listio_max; + if ((mode != LIO_NOWAIT) && (mode != LIO_WAIT)) return (EINVAL); - if (nent < 0 || nent > AIO_LISTIO_MAX) + aio_listio_max = p31b_getcfg(CTL_P1003_1B_AIO_LISTIO_MAX); + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (p->p_aioinfo == NULL) @@ -2277,13 +2289,14 @@ struct aiocb **acb_list; struct sigevent *sigp, sig; struct osigevent osig; - int error, nent; + int error, nent, aio_listio_max; if ((uap->mode != LIO_NOWAIT) && (uap->mode != LIO_WAIT)) return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + aio_listio_max = p31b_getcfg(CTL_P1003_1B_AIO_LISTIO_MAX); + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2314,13 +2327,14 @@ { struct aiocb **acb_list; struct sigevent *sigp, sig; - int error, nent; + int error, nent, aio_listio_max; if ((uap->mode != LIO_NOWAIT) && (uap->mode != LIO_WAIT)) return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + aio_listio_max = p31b_getcfg(CTL_P1003_1B_AIO_LISTIO_MAX); + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2787,9 +2801,10 @@ struct timespec ts, *tsp; struct aiocb **ujoblist; uint32_t *ujoblist32; - int error, i; + int error, i, aio_listio_max; - if (uap->nent < 0 || uap->nent > AIO_LISTIO_MAX) + aio_listio_max = p31b_getcfg(CTL_P1003_1B_AIO_LISTIO_MAX); + if (uap->nent < 0 || uap->nent > aio_listio_max) return (EINVAL); if (uap->timeout) { @@ -2909,13 +2924,14 @@ struct sigevent *sigp, sig; struct osigevent32 osig; uint32_t *acb_list32; - int error, i, nent; + int error, i, nent, aio_listio_max; if ((uap->mode != LIO_NOWAIT) && (uap->mode != LIO_WAIT)) return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + aio_listio_max = p31b_getcfg(CTL_P1003_1B_AIO_LISTIO_MAX); + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2955,13 +2971,14 @@ struct sigevent *sigp, sig; struct sigevent32 sig32; uint32_t *acb_list32; - int error, i, nent; + int error, i, nent, aio_listio_max; if ((uap->mode != LIO_NOWAIT) && (uap->mode != LIO_WAIT)) return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + aio_listio_max = p31b_getcfg(CTL_P1003_1B_AIO_LISTIO_MAX); + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) {