[ltt-dev] [PATCH 4/5] rculfhash: fix check_resize()

Lai Jiangshan laijs at cn.fujitsu.com
Thu Oct 27 23:57:27 EDT 2011


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 <laijs at cn.fujitsu.com>
---
 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





More information about the lttng-dev mailing list