From owner-svn-src-head@FreeBSD.ORG Mon Nov 3 09:29:50 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 19DE5E64; Mon, 3 Nov 2014 09:29:50 +0000 (UTC) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (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 364152C7; Mon, 3 Nov 2014 09:29:49 +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 97C491FE022; Mon, 3 Nov 2014 10:29:46 +0100 (CET) Message-ID: <54574B16.8030808@selasky.org> Date: Mon, 03 Nov 2014 10:29:58 +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: r274017 - head/sys/kern References: <201411030746.sA37kpPu037113@svn.freebsd.org> <54573AEE.9010602@freebsd.org> <54573B87.7000801@freebsd.org> <54573CD2.1000702@selasky.org> <20141103092132.GH29497@dft-labs.eu> In-Reply-To: <20141103092132.GH29497@dft-labs.eu> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: src-committers@freebsd.org, Mateusz Guzik , jmallett@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Julian Elischer 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: Mon, 03 Nov 2014 09:29:50 -0000 On 11/03/14 10:21, Mateusz Guzik wrote: > On Mon, Nov 03, 2014 at 09:29:06AM +0100, Hans Petter Selasky wrote: >> On 11/03/14 09:23, Julian Elischer wrote: >>> On 11/3/14, 4:21 PM, Julian Elischer wrote: >>>> On 11/3/14, 3:46 PM, Mateusz Guzik wrote: >>>>> Author: mjg >>>>> Date: Mon Nov 3 07:46:51 2014 >>>>> New Revision: 274017 >>>>> URL: https://svnweb.freebsd.org/changeset/base/274017 >>>>> >>>>> Log: >>>>> Provide an on-stack temporary buffer for small ioctl requests. >>>> I'm not sure I like this. We don't know how many more levels >>>> of stack may be needed. >>>> I know that machines are getting faster with more memory, >>>> but the current move towards bloating out the >>> ... "bloating out the stack" ... >>>> worries me. we started out with a single page of stack (SHARED >>>> with the U-area!). I think we are now at several pages.. I forget, is >>>> it 8? >>>> I'm open to being persuaded but I think we need to have a discussion >>>> about stack usage. We used to say that anything greater that, say >>>> 64 bytes should probably be allocated. >>>> >> >> Hi, >> >> I think this patch can give a benefit for the USB stack and CUSE4BSD, >> because it does frequent IOCTLs. Regarding the stack usage, maybe >> this general purpose optimisation can be allocated from the thread >> structure? >> > > I was considering something like that. The idea is that frequently > allocating threads could allocate, say, 1KB from malloc and use that > to satisfy their needs. This definitely helps offenders with longer > lifespan, but does not help short-lived ones. Hi, This might be non-deterministic behaviour. I'm thinking about IOCTL latency, that its better when the latency is constant all the time. > > That said, maybe I'm over-engineering this, but for cases where increased > stack usage is undersirable we could have a malloc wrapper for use by > code which knows it allocates stuff just to free it after the request. Maybe the size you allocate from the stack could be some kind of kernel option, having some sensible default like 64 bytes when not set. > > When it concludes a threshold is reached, allocates some memory and > keeps it around. It can easily support multiple "allocations" from that > buffer and fallbak to malloc if it runs out of space. > Don't forget to MFC! --HPS