Subject: Re: struct file reference counts
To: David Laight <David.Laight@btinternet.com>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: tech-kern
Date: 12/16/2001 15:18:12
David Laight wrote:
> IMHO I would have thought that 32bits would be enough...

Yes, it is more than enough on 32bit archs. Also, 'long' is actually
2^32 times bigger than 'int' on lp64 archs, so it's as good
as reference counter as 32bit long for 32bit archs. All in all,
'long' should not be overflowable as reference counter on both LP32 and LP64
archs.

> I presume you've seem the 16bit counter wrap - with obvious devistating
> results...

Yes, I've seen the 16bit counter wrap.

> However the extra 8 bytes per 'file' is probably a higher cost in kvm.

Yes, that too. Furthermore, 64bit arithmetic is costly on 32bit
archs. For reference counters, it's entrirely supeflouous to have
64bit counters on 32bit archs.

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org> http://www.NetBSD.org/Ports/i386/ps2.html
-=  Those who would give up liberty for a little temporary safety deserve  =-
-=  neither liberty nor safety, and will lose both.  -- Benjamin Franklin  =-