From owner-freebsd-current Wed Mar 29 22:28:13 2000 Delivered-To: freebsd-current@freebsd.org Received: from mass.cdrom.com (mg136-158.ricochet.net [204.179.136.158]) by hub.freebsd.org (Postfix) with ESMTP id 7C02337B590 for ; Wed, 29 Mar 2000 22:28:03 -0800 (PST) (envelope-from msmith@mass.cdrom.com) Received: from mass.cdrom.com (localhost [127.0.0.1]) by mass.cdrom.com (8.9.3/8.9.3) with ESMTP id WAA00497; Wed, 29 Mar 2000 22:31:18 -0800 (PST) (envelope-from msmith@mass.cdrom.com) Message-Id: <200003300631.WAA00497@mass.cdrom.com> X-Mailer: exmh version 2.1.1 10/15/1999 To: Alfred Perlstein Cc: Matthew Dillon , freebsd-current@FreeBSD.ORG Subject: Re: Using packed structs to gain cheap SMP primatives In-reply-to: Your message of "Wed, 29 Mar 2000 19:25:29 PST." <20000329192526.U21029@fw.wintelcom.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 29 Mar 2000 22:31:17 -0800 From: Mike Smith Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Yesterday I was looking at how Linux handles the gettimeofday stuff > without locking thier sys_tz variable, well it seems they don't care > or I'm missing something important. > > They just don't lock it, not that settimeofday will be called all that > often but it leaves me wondering what we can do about this, effectively > we can pack our tz (sys_tz in Linux) into a 32bit value which should > afford us read/write atomicity on every platform I'm aware of. > > In fact this can be quite effective for certain types of data structures, > even though our 'struct timezone' is two ints we can pack it into two > uint16 and pack a private structure, then copy it to a stack and expand > it into the user's address space. It would be cheaper just to lock the bloody thing, although you can't pack all the significance of a timeval into 16 bits anyway (in a fashion that's going to make many people happy). -- \\ Give a man a fish, and you feed him for a day. \\ Mike Smith \\ Tell him he should learn how to fish himself, \\ msmith@freebsd.org \\ and he'll hate you for a lifetime. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message