Re: [PATCH net 2/2] rhashtable: remove indirection for grow/shrink decision functions
From: "tgraf@suug.ch" <tgraf@suug.ch>
Date: 2015-02-26 10:02:40
From: "tgraf@suug.ch" <tgraf@suug.ch>
Date: 2015-02-26 10:02:40
On 02/25/15 at 09:41am, Eric Dumazet wrote:
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.
I don't think we need to kill shrink to get rid of the elements counters. It looks all users of shrink could trigger it manually by maintaing their own element counter, we just have to export the shrink function. I just want to point out here that TCP is not the only future use case. The station table for mac80211 has recently been converted. We need to keep all of them on the radar.