aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2014-11-28 09:32:07 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2014-11-28 09:32:07 +0000
commit50ae6690fcef28e806f580fe7bb0b213e0e54df3 (patch)
tree913f298c2ca9577e565a1441d131da52e45fad4d
parent006e24e90963dc20b2d927876ad402a652ad1f07 (diff)
downloadsrc-50ae6690fcef28e806f580fe7bb0b213e0e54df3.tar.gz
src-50ae6690fcef28e806f580fe7bb0b213e0e54df3.zip
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
Notes
Notes: svn path=/head/; revision=275205
-rw-r--r--sys/kern/sys_generic.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/sys/kern/sys_generic.c b/sys/kern/sys_generic.c
index 01996155e4cc..8dddc9b556f6 100644
--- a/sys/kern/sys_generic.c
+++ b/sys/kern/sys_generic.c
@@ -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;