From owner-svn-src-head@FreeBSD.ORG Tue Nov 4 11:46:54 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 34A5A386; Tue, 4 Nov 2014 11:46:54 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (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 EC0B0177; Tue, 4 Nov 2014 11:46:53 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id B5A8B1FE022; Tue, 4 Nov 2014 12:46:51 +0100 (CET) Message-ID: <5458BCB7.5090309@selasky.org> Date: Tue, 04 Nov 2014 12:47:03 +0100 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-Version: 1.0 To: Mateusz Guzik Subject: Re: svn commit: r274088 - head/sys/kern References: <201411041129.sA4BTnwX030600@svn.freebsd.org> <20141104114041.GA21297@dft-labs.eu> In-Reply-To: <20141104114041.GA21297@dft-labs.eu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 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, 04 Nov 2014 11:46:54 -0000 On 11/04/14 12:40, Mateusz Guzik wrote: > On Tue, Nov 04, 2014 at 11:29:49AM +0000, Hans Petter Selasky wrote: >> Author: hselasky >> Date: Tue Nov 4 11:29:49 2014 >> New Revision: 274088 >> URL: https://svnweb.freebsd.org/changeset/base/274088 >> >> Log: >> Simplify logic a bit. Ensure data buffer is properly aligned, >> especially for platforms where unaligned access is not allowed. Make >> it possible to override the small buffer size. >> >> A simple continuous read string test using libusb showed a reduction >> in CPU usage from roughly 10% to less than 1% using a dual-core GHz >> CPU, when the malloc() operation was skipped for small buffers. >> >> MFC after: 2 weeks >> >> Modified: >> head/sys/kern/sys_generic.c >> >> Modified: head/sys/kern/sys_generic.c >> ============================================================================== >> --- head/sys/kern/sys_generic.c Tue Nov 4 10:25:52 2014 (r274087) >> +++ head/sys/kern/sys_generic.c Tue Nov 4 11:29:49 2014 (r274088) >> @@ -646,10 +646,13 @@ 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); > Hi, > Should not you align to word size instead? You mean 32-bit words? I think mips64 will require 64-bit alignment. I just put the value for the worst case. Possibly "sizeof(long)" might work. > > Also maybe it would be beneficial to derive the limit from KSTACK_PAGES > (something silly like KSTACK_PAGES * 32 or something), which I believe would > address earlier complaints. If this is going to give a performance improvement in the USB area, the small size must be greater or equal to 64 at least, or somewhere around there. --HPS