[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130128215042.GN22465@mtj.dyndns.org>
Date: Mon, 28 Jan 2013 13:50:42 -0800
From: Tejun Heo <tj@...nel.org>
To: Kent Overstreet <koverstreet@...gle.com>
Cc: Oleg Nesterov <oleg@...hat.com>, srivatsa.bhat@...ux.vnet.ibm.com,
rusty@...tcorp.com.au, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] generic dynamic per cpu refcounting
Hello, Kent.
On Mon, Jan 28, 2013 at 01:45:06PM -0800, Kent Overstreet wrote:
> Ahh. Bias value sounds... hacky (i.e. harder to convince myself it's
> correct) but I see what you're getting at.
I don't think it's that hacky. Just push the base point to the
opposite of zero - LLONG_MAX. The global counter can start biased so
that it gets unbiased only once dying is confirmed and everything can
blindly do atomic64_dec_and_test() and trust the result.
> Something to consider is wrapping; after we set state to dying but
> before we've collected the percpu counters, the atomic counter may be
> negative.
There's a reason why we use 64bit vars for this type of global
counting. They virtually don't wrap. Here, you'll need 1<<63 for the
counter to unintentionally reach 0, which we consider practically
impossible.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists