From owner-freebsd-arch@FreeBSD.ORG Sun Aug 18 01:30:37 2013 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1E6AF6F; Sun, 18 Aug 2013 01:30:37 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id D6E782690; Sun, 18 Aug 2013 01:30:36 +0000 (UTC) Received: from c122-106-156-23.carlnfd1.nsw.optusnet.com.au (c122-106-156-23.carlnfd1.nsw.optusnet.com.au [122.106.156.23]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id CD8C5D621CC; Sun, 18 Aug 2013 11:30:23 +1000 (EST) Date: Sun, 18 Aug 2013 11:30:22 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Poul-Henning Kamp Subject: Re: suspend/resume time-gap and expiration timers in network stack In-Reply-To: <10980.1376759837@critter.freebsd.dk> Message-ID: <20130818101945.T880@besplex.bde.org> References: <20130817.173019.1478850854128616078.hrs@allbsd.org> <20130818004948.L4326@besplex.bde.org> <10980.1376759837@critter.freebsd.dk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=bpB1Wiqi c=1 sm=1 tr=0 a=ebeQFi2P/qHVC0Yw9JDJ4g==:117 a=PO7r1zJSAAAA:8 a=-G4Y16xk-08A:10 a=kj9zAlcOel0A:10 a=JzwRw_2MAAAA:8 a=lWkSEhi8E8gA:10 a=F3WKRGcORFVHpHynyrcA:9 a=CjuIK1q_8ugA:10 Cc: arch@FreeBSD.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2013 01:30:37 -0000 On Sat, 17 Aug 2013, Poul-Henning Kamp wrote: > In message <20130818004948.L4326@besplex.bde.org>, Bruce Evans writes: > >> The boot time is then set to the real time, >> to maintain the (buggy) invariant real_time = monotonic_time + boottime. > >> real_time = monotonic_time + base_time > > That was a lot of verbiage just to change the name of a variable :-) No, it just wasn't verbose enough to describe the full details for the boottime[bin,etc] variable. It must be maintained (with fixes) for use by the kern.boottime sysctl. In general, every clock id may have a different base with different initialization requirements. The bases for CLOCK_MONOTONIC and CLOCK_REALTIME differ by leap seconds and not much more. To avoid adding the base to the monotonic time every time it is used, the base for the monotonic time should be 0, with the offset from the boot time part of the timehands. You even get a free optimization from this. The difference between CLOCK_REALTIME and CLOCK_MONOTONIC becomes just the leap seconds adjustment. This is an integer, so it is easier to lock and more efficient to add than a full bintime. Bruce