[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1424886096.5565.104.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Wed, 25 Feb 2015 09:41:36 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Daniel Borkmann <daniel@...earbox.net>
Cc: David Laight <David.Laight@...LAB.COM>,
"davem@...emloft.net" <davem@...emloft.net>,
"tgraf@...g.ch" <tgraf@...g.ch>,
"pablo@...filter.org" <pablo@...filter.org>,
"johunt@...mai.com" <johunt@...mai.com>,
"kaber@...sh.net" <kaber@...sh.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net 2/2] rhashtable: remove indirection for grow/shrink
decision functions
On Wed, 2015-02-25 at 17:14 +0100, Daniel Borkmann wrote:
> The nelems can be a percpu_counter where we have a batched sync
> point and can make that dependent on the current table shift as
> we don't need to be overly precise, we can just read the sync'ed
> value. Currently, nelems are also being used by rhashtable users
> outside of the core code to track if we are still allowed to
> insert new elements, but I think we might also want to address
> that at some point.
There is no need to track number of elements, using either an atomic_t
or percpu_counter. This adds unnecessary burden.
1) Automatic shrinking is a non issue. This will free very little
memory, compared to previous peak usage (including objects put in
rhashtable). If hash grown to a certain point, it's likely it will grow
again later.
2) Growing can be triggered when any bucket has more than X elems, and
that is given for free at insert time.
X could be log2(buckets)/2 I guess. (aka shift/2)
A global limit on number of elements should be controlled by rhashtable
users - if needed -, not in the rhashtable itself.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists