From owner-svn-src-all@FreeBSD.ORG Tue Nov 4 05:41:50 2014 Return-Path: Delivered-To: svn-src-all@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 98CF63AD; Tue, 4 Nov 2014 05:41:50 +0000 (UTC) Received: from mail-wg0-x22e.google.com (mail-wg0-x22e.google.com [IPv6:2a00:1450:400c:c00::22e]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8DC95219; Tue, 4 Nov 2014 05:41:49 +0000 (UTC) Received: by mail-wg0-f46.google.com with SMTP id x13so12718101wgg.33 for ; Mon, 03 Nov 2014 21:41:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=4MzNrU7qXZvL6GEMDm+tXCCCaqKYQHMH9/APEqCrq3U=; b=RPKOmRNkLWLi02TG1pLSRoBJez4HveoVlNkNLRBiGK4JczitmffYDX2ielz34AK3o+ RilxyLV1Ko1O6ZI7A0dgJ4DSibS3R20mPlhDUDPAnOPwR1MX/u8gMCYFxKqJ0GJ7J1q5 82uupuuKcaQspAGDdQUfiGeoa9C8VMbvVbfk4drJOfw0EanDHySmPdy0jNE+Cz6ANxKt dLCkKVlzk2cobsv27CU/NF9UbhGxIQW9Kvos+DPjnqsIqLQJo6rk9TpSgrXNSIbtS6pv uZ5TpnfMfHuT7yBiqXEXGcFtYMfGOJqTlpbdhUhvACQVyR8p70DPpRDbn/i2DNf38cAv u/0A== X-Received: by 10.180.82.170 with SMTP id j10mr21503553wiy.35.1415079707917; Mon, 03 Nov 2014 21:41:47 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id v10sm7271281wiy.21.2014.11.03.21.41.46 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 03 Nov 2014 21:41:47 -0800 (PST) Date: Tue, 4 Nov 2014 06:41:44 +0100 From: Mateusz Guzik To: Poul-Henning Kamp Subject: Re: svn commit: r274017 - head/sys/kern Message-ID: <20141104054144.GB4032@dft-labs.eu> References: <201411030746.sA37kpPu037113@svn.freebsd.org> <54573AEE.9010602@freebsd.org> <54573B87.7000801@freebsd.org> <54573CD2.1000702@selasky.org> <20141103092132.GH29497@dft-labs.eu> <20141103100847.GK53947@kib.kiev.ua> <20141104045159.E1605@besplex.bde.org> <79454.1415043356@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <79454.1415043356@critter.freebsd.dk> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Hans Petter Selasky , src-committers@freebsd.org, jmallett@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Bruce Evans , Konstantin Belousov , Julian Elischer X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2014 05:41:50 -0000 re-sent with trimmed cc On Mon, Nov 03, 2014 at 07:35:56PM +0000, Poul-Henning Kamp wrote: > -------- > In message <20141104045159.E1605@besplex.bde.org>, Bruce Evans writes: > > >This optimization is probably minor, but reminds me of other syscalls > >that would benefit using a single largish allocation up front: > >- all vfs calls that start with namei(). They allocate PATH_MAX (1K) > > bytes and more. An 8K stack has plently to spare after allocating > > 1K. However, if malloc() is used then the PATH_MAX limit shouldn't > > exist. Only a limit to prevent denial of service is needed. > > We should actually roll a new rev of all syscalls which take a path > and have them pass strlen(path)+1 into the kernel. > > That would allow both precise allocation and faster copyin, followed > by a check that the last byte is (still) a NUL. > I think we can speed up things on amd64 no problem without affecting userspace. amd64's copyinstr (and most likely all others) copy byte by byte. What we can do is copy word size and fall back to byte by byte on page fault. Ten on each iteration check if 0 was encountered. Maybe there will be a way of doing it in even in C without much hassle. -- Mateusz Guzik