When I force the accounting unavailable but with CDS_LFHT_AUTO_RESIZE,
the hash table will grow very very large, which is bad.

I think the logic in check_resize() is not good, size is more proper
for indicating a hash table small or not.

Signed-off-by: Lai Jiangshan <[email protected]>
---
 rculfhash.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/rculfhash.c b/rculfhash.c
index 5ea133f..c0c452c 100644
--- a/rculfhash.c
+++ b/rculfhash.c
@@ -639,16 +639,13 @@ void ht_count_del(struct cds_lfht *ht, unsigned long 
size, unsigned long hash)
 static
 void check_resize(struct cds_lfht *ht, unsigned long size, uint32_t chain_len)
 {
-       unsigned long count;
-
        if (!(ht->flags & CDS_LFHT_AUTO_RESIZE))
                return;
-       count = uatomic_read(&ht->count);
        /*
         * Use bucket-local length for small table expand and for
         * environments lacking per-cpu data support.
         */
-       if (count >= (1UL << COUNT_COMMIT_ORDER))
+       if (size >= (1UL << COUNT_COMMIT_ORDER))
                return;
        if (chain_len > 100)
                dbg_printf("WARNING: large chain length: %u.\n",
-- 
1.7.4.4


_______________________________________________
ltt-dev mailing list
[email protected]
http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev

Reply via email to