From owner-svn-src-head@freebsd.org Tue Aug 8 16:14:33 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58D76DC0D93; Tue, 8 Aug 2017 16:14:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34F31683EB; Tue, 8 Aug 2017 16:14:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v78GEWl2066450; Tue, 8 Aug 2017 16:14:32 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v78GEVGY066448; Tue, 8 Aug 2017 16:14:31 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201708081614.v78GEVGY066448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Tue, 8 Aug 2017 16:14:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322258 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 322258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 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: Tue, 08 Aug 2017 16:14:33 -0000 Author: asomers Date: Tue Aug 8 16:14:31 2017 New Revision: 322258 URL: https://svnweb.freebsd.org/changeset/base/322258 Log: Make p1003_1b.aio_listio_max a tunable p1003_1b.aio_listio_max is now a tunable. Its value is reflected in the sysctl of the same name, and the sysconf(3) variable _SC_AIO_LISTIO_MAX. Its value will be bounded from below by the compile-time constant AIO_LISTIO_MAX and from above by the compile-time constant MAX_AIO_QUEUE_PER_PROC and the tunable vfs.aio.max_aio_queue. Reviewed by: jhb, kib MFC after: 3 weeks Relnotes: yes Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11601 Modified: head/sys/kern/posix4_mib.c head/sys/kern/vfs_aio.c Modified: head/sys/kern/posix4_mib.c ============================================================================== --- head/sys/kern/posix4_mib.c Tue Aug 8 16:06:16 2017 (r322257) +++ head/sys/kern/posix4_mib.c Tue Aug 8 16:14:31 2017 (r322258) @@ -91,7 +91,6 @@ P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync); 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(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); Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Tue Aug 8 16:06:16 2017 (r322257) +++ head/sys/kern/vfs_aio.c Tue Aug 8 16:14:31 2017 (r322258) @@ -102,6 +102,7 @@ static uint64_t jobseqno; #endif FEATURE(aio, "Asynchronous I/O"); +SYSCTL_DECL(_p1003_1b); static MALLOC_DEFINE(M_LIO, "lio", "listio aio control block list"); @@ -168,6 +169,11 @@ 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)"); +static int aio_listio_max = AIO_LISTIO_MAX; +SYSCTL_INT(_p1003_1b, CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max, + CTLFLAG_RDTUN | CTLFLAG_CAPRD, &aio_listio_max, 0, + "Maximum aio requests for a single lio_listio call"); + #ifdef COMPAT_FREEBSD6 typedef struct oaiocb { int aio_fildes; /* File descriptor */ @@ -388,6 +394,11 @@ static int aio_onceonly(void) { + if (aio_listio_max < AIO_LISTIO_MAX) + aio_listio_max = AIO_LISTIO_MAX; + if (aio_listio_max > MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count)) + aio_listio_max = MIN(MAX_AIO_QUEUE_PER_PROC, max_queue_count); + 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 +416,13 @@ aio_onceonly(void) 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, - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + 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); @@ -1943,7 +1953,7 @@ sys_aio_suspend(struct thread *td, struct aio_suspend_ struct aiocb **ujoblist; int error; - if (uap->nent < 0 || uap->nent > AIO_LISTIO_MAX) + if (uap->nent < 0 || uap->nent > aio_listio_max) return (EINVAL); if (uap->timeout) { @@ -2151,7 +2161,7 @@ kern_lio_listio(struct thread *td, int mode, struct ai if ((mode != LIO_NOWAIT) && (mode != LIO_WAIT)) return (EINVAL); - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (p->p_aioinfo == NULL) @@ -2283,7 +2293,7 @@ freebsd6_lio_listio(struct thread *td, struct freebsd6 return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2320,7 +2330,7 @@ sys_lio_listio(struct thread *td, struct lio_listio_ar return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2789,7 +2799,7 @@ freebsd32_aio_suspend(struct thread *td, struct freebs uint32_t *ujoblist32; int error, i; - if (uap->nent < 0 || uap->nent > AIO_LISTIO_MAX) + if (uap->nent < 0 || uap->nent > aio_listio_max) return (EINVAL); if (uap->timeout) { @@ -2915,7 +2925,7 @@ freebsd6_freebsd32_lio_listio(struct thread *td, return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) { @@ -2961,7 +2971,7 @@ freebsd32_lio_listio(struct thread *td, struct freebsd return (EINVAL); nent = uap->nent; - if (nent < 0 || nent > AIO_LISTIO_MAX) + if (nent < 0 || nent > aio_listio_max) return (EINVAL); if (uap->sig && (uap->mode == LIO_NOWAIT)) {