From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 31 01:45:38 2009 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A00A106564A; Tue, 31 Mar 2009 01:45:38 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from sippysoft.com (gk1.360sip.com [72.236.70.240]) by mx1.freebsd.org (Postfix) with ESMTP id E1B248FC18; Tue, 31 Mar 2009 01:45:37 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from [192.168.1.38] (S0106001372fd1e07.vs.shawcable.net [70.71.171.106]) (authenticated bits=0) by sippysoft.com (8.14.3/8.14.3) with ESMTP id n2V1jZkS053755 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 30 Mar 2009 18:45:36 -0700 (PDT) (envelope-from sobomax@FreeBSD.org) Message-ID: <49D175BA.6050307@FreeBSD.org> Date: Mon, 30 Mar 2009 18:45:30 -0700 From: Maxim Sobolev Organization: Sippy Software, Inc. User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Robert Watson References: <33531707.21385.1238188446396.JavaMail.root@vms074.mailsrvcs.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Sergey Babkin , freebsd-hackers@FreeBSD.org, attilio@FreeBSD.org, phk@phk.freebsd.dk, freebsd-current@FreeBSD.org, prashant.vaibhav@gmail.com Subject: Re: Improving the kernel/i386 timecounter performance (GSoC proposal) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Mar 2009 01:45:38 -0000 Robert Watson wrote: > Part of the point of mapping in the page at execve()-time, or > fork()-time for per-process pages (which I'm not entirely convinced we > need yet) is to avoid the cost of an extra device open, mmap, etc, for > every execve(), which can be quite expensive. I stuck a prototype page You don't really need to do it on every execve() unconditionally. It could be done on demand in libc, so that only when thread pass certain threshold, the "common page optimization code" kicks in and does its open/mmap/etc magic. Otherwise, "normal" syscall is performed. The implementation could be as simple as counter in the appropriate libc routine, so that optimization engages after certain number of calls. For syscalls that return time it's also easy to do frequency thresholds, so that for example gettimeofday() only gets optimized if threads calls it more frequently that 1 call/sec. -Maxim