From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 18 19:43:12 2012 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 76BAE106566B; Sat, 18 Feb 2012 19:43:12 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id CEB328FC0A; Sat, 18 Feb 2012 19:43:11 +0000 (UTC) Received: by wibhn14 with SMTP id hn14so3421988wib.13 for ; Sat, 18 Feb 2012 11:43:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=OSX+641liIhz1BRl1EzM2VDcoWJlJwGwBvSA9foaTFc=; b=JH7hKZU1D6OSpQqrLQVuf+0JlIm3I2QPtGL2vDCC4X0gScbR6ja+anuWD28g1GeC/T o+566UCFYQZKi4L89wQmc0Um9xovQIrX8SxCvhwXE/2q5ZQ3nMFxybxerOpuN4P33UTB GKQ+GAHWe9XX66lPhjDvhajXwqQwUd+9spamM= Received: by 10.180.83.97 with SMTP id p1mr4663161wiy.19.1329594190748; Sat, 18 Feb 2012 11:43:10 -0800 (PST) Received: from mavbook.mavhome.dp.ua (95-109-198-194.dialup.umc.net.ua. [95.109.198.194]) by mx.google.com with ESMTPS id m16sm13175709wie.9.2012.02.18.11.43.04 (version=SSLv3 cipher=OTHER); Sat, 18 Feb 2012 11:43:09 -0800 (PST) Sender: Alexander Motin Message-ID: <4F3FFF33.2050700@FreeBSD.org> Date: Sat, 18 Feb 2012 21:42:43 +0200 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120116 Thunderbird/9.0 MIME-Version: 1.0 To: Andriy Gapon References: <4F3FF690.5050600@FreeBSD.org> In-Reply-To: <4F3FF690.5050600@FreeBSD.org> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@FreeBSD.org Subject: Re: callouts precision 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: Sat, 18 Feb 2012 19:43:12 -0000 On 18.02.2012 21:05, Andriy Gapon wrote: > Just want to double-check myself. > It seems that currently, thanks to event timers, we mostly should be able to > schedule a hardware timer to fire at almost arbitrary moment with very fine > precision. > OTOH, our callout subsystem still seems to be completely tick oriented in the > sense that all timeouts are specified and kept in ticks. > As a result, it's impossible to use e.g. nanosleep(2) with a precision better > than HZ. > > How deeply ticks are ingrained into callout(9)? Are they used only as a measure > of time? Or are there any dependencies on them being integers, like for > indexing, etc? > In other words, how hard it would be to replace ticks with e.g. bintime as an > internal representation of time in callout(9) [leaving interfaces alone for the > start]? Is it easier to retrofit that code or to replace it with something new? Pending callouts are now stored in large array of unsorted lists, where last bits of callout time is the array index. It is quite effective for insert/delete operation. It is ineffective for getting next event time needed for new event timers, but it is rare operation. Using arbitrary time values in that case is very problematic. It would require complete internal redesign. -- Alexander Motin