Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Sep 2000 11:16:21 -0700
From:      Mike Smith <msmith@freebsd.org>
To:        Alfred Perlstein <bright@wintelcom.net>
Cc:        arch@freebsd.org
Subject:   Re: we need atomic_t 
Message-ID:  <200009281816.e8SIGLA01632@mass.osd.bsdi.com>
In-Reply-To: Your message of "Thu, 28 Sep 2000 11:06:37 PDT." <20000928110637.U7553@fw.wintelcom.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Linux has a datatype called "atomic_t", very useful for refcounts
> and struct counters like tcpstat.  My impression is that it's the
> largest type an arch can support atomic ops on without weird
> gyrations and/or extremely expensive operations.

sig_atomic_t.

> This would replace our atomic_op_type with just atomic_op and make
> code easier to read and get right.

I strongly disagree.  The atomic_<op>_<type> interface is useful and 
necessary and should remain.  I don't agree that this would make anything 
easier.  In particular, the explicit use of the atomic_* operations makes 
the atomicity constraints very clear.

> I'm already seeing a pretty good examples of where this can be
> applied:
> 
> 1) struct ucred->cr_ref
> 2) struct uidinfo->ui_ref
> 3) tcpstats
> 4) other stats :)
> 5) mbuf external ref counts
> 
> I don't have the gcc-assembler-foo to do this optimally without
> directly copying from Linux which isn't acceptable.

In most cases, you're manipulating the reference count under a mutex 
(since there's no other way to avoid the race where someone else frees 
your structure while you're in the process of dereferencing it), so this 
is largely unnecessary.

> Can anyone snap this up?   I'd really appreciate it.

Hold it right there, sunshine.  8)

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009281816.e8SIGLA01632>