Date: Fri, 28 Nov 2014 09:32:07 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r275205 - head/sys/kern Message-ID: <201411280932.sAS9W7gF003751@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Fri Nov 28 09:32:07 2014 New Revision: 275205 URL: https://svnweb.freebsd.org/changeset/base/275205 Log: Style changes: - Move two IOCTL related defines to the top of the C-file - Add more comments describing the recently added IOCTL small size and small align macros Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Fri Nov 28 09:23:15 2014 (r275204) +++ head/sys/kern/sys_generic.c Fri Nov 28 09:32:07 2014 (r275205) @@ -75,6 +75,20 @@ __FBSDID("$FreeBSD$"); #include <security/audit/audit.h> +/* + * The following macro defines how many bytes will be allocated from + * the stack instead of memory allocated when passing the IOCTL data + * structures from userspace and to the kernel. Some IOCTLs having + * small data structures are used very frequently and this small + * buffer on the stack gives a significant speedup improvement for + * those requests. The value of this define should be greater or equal + * to 64 bytes and should also be power of two. The data structure is + * currently hard-aligned to a 8-byte boundary on the stack. This + * should currently be sufficient for all supported platforms. + */ +#define SYS_IOCTL_SMALL_SIZE 128 /* bytes */ +#define SYS_IOCTL_SMALL_ALIGN 8 /* bytes */ + int iosize_max_clamp = 0; SYSCTL_INT(_debug, OID_AUTO, iosize_max_clamp, CTLFLAG_RW, &iosize_max_clamp, 0, "Clamp max i/o size to INT_MAX"); @@ -646,10 +660,7 @@ struct ioctl_args { int sys_ioctl(struct thread *td, struct ioctl_args *uap) { -#ifndef SYS_IOCTL_SMALL_SIZE -#define SYS_IOCTL_SMALL_SIZE 128 -#endif - u_char smalldata[SYS_IOCTL_SMALL_SIZE] __aligned(8); + u_char smalldata[SYS_IOCTL_SMALL_SIZE] __aligned(SYS_IOCTL_SMALL_ALIGN); u_long com; int arg, error; u_int size;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411280932.sAS9W7gF003751>