[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <30458.1504541309@warthog.procyon.org.uk>
Date: Mon, 04 Sep 2017 17:08:29 +0100
From: David Howells <dhowells@...hat.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: dhowells@...hat.com, linux-afs@...ts.infradead.org,
Peter Zijlstra <peterz@...radead.org>,
linux-fsdevel@...r.kernel.org, Kees Cook <keescook@...omium.org>,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 02/11] refcount: Implement inc/decrement-and-return functions
Christoph Hellwig <hch@...radead.org> wrote:
> > Implement functions that increment or decrement a refcount_t object and
> > return the value. The dec-and-ret function can be used to maintain a
> > counter in a cache where 1 means the object is unused, but available and
> > the garbage collector can use refcount_dec_if_one() to make the object
> > unavailable. Further, both functions can be used to accurately trace the
> > refcount (refcount_inc() followed by refcount_read() can't be considered
> > accurate).
>
> Please just use a different interface for that instead of overloading
> refcount_t. The main use case of that type is that it is so simple that
> it is hard to get wrong (and have additional checking if things go
> wrong)
Which bit are you objecting to? Wanting to use a refcount_t with 1 to
represent an otherwise-unreferenced object sat in a cache? Or wanting to
display accurate usage counts when tracing gets and puts of objects?
David
Powered by blists - more mailing lists