From owner-freebsd-hackers@FreeBSD.ORG Mon Mar 29 16:16:40 2010 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 CF2AC106564A for ; Mon, 29 Mar 2010 16:16:40 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 9E51C8FC12 for ; Mon, 29 Mar 2010 16:16:40 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 476AC46B8F; Mon, 29 Mar 2010 12:16:40 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 65A898A01F; Mon, 29 Mar 2010 12:16:39 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Mon, 29 Mar 2010 10:44:28 -0400 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) References: <4BACC791.70502@icyb.net.ua> <20100327214634.GI32799@server.vk2pj.dyndns.org> <86fx3k7jqi.fsf@ds4.des.no> In-Reply-To: <86fx3k7jqi.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201003291044.28544.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 29 Mar 2010 12:16:39 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.7 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Dag-Erling =?utf-8?q?Sm=C3=B8rgrav?= , Andriy Gapon Subject: Re: periodically save current time to time-of-day hardware 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: Mon, 29 Mar 2010 16:16:40 -0000 On Sunday 28 March 2010 7:45:25 am Dag-Erling Sm=C3=B8rgrav wrote: > Peter Jeremy writes: > > A new kthread which sleeps on channel "update_rtc". When woken, it > > checks to see if it's within (say) 50msec of a second boundary and so, > > it does a trylock on the (new) RTC mutex. If it grabs the mutex then > > it performs the update. If it was too far from the second boundary or > > it fails to grab the mutex then it sleeps until the next second > > boundary and tries again. > > > > The existing resettodr() would then turn into a wakeup(update_rtc). >=20 > Sounds good to me, but if only that thread has access to the RTC, why > bother with a mutex? I would dispense with the kthread and just use a callout (or have a callout= =20 schedule a task for taskqueue_thread). =2D-=20 John Baldwin