Thread (15 messages) 15 messages, 3 authors, 2018-06-04

Re: [PATCH 2/5] lib/rhashtable: guarantee initial hashtable allocation

From: Davidlohr Bueso <dave@stgolabs.net>
Date: 2018-06-02 05:41:44
Also in: lkml

On Sat, 02 Jun 2018, Herbert Xu wrote:
quoted
 	tbl = bucket_table_alloc(ht, size, GFP_KERNEL);
-	if (tbl == NULL)
-		return -ENOMEM;
+	if (unlikely(tbl == NULL)) {
+		size = min_t(u16, ht->p.min_size, HASH_MIN_SIZE);
You mean max_t?
Not really. I considered some of the users to set quite a large min_size
(such as 1024 buckets). The min() makes sense to me in that it's the smallest
possible value. If memory later becomes available and the hashtable is resized
to a more appropriate value, couldn't any issues regarding collisions not be dealt
with organically? And we've agreed that allocating a tiny table is the
least of our problems.

Thanks,
Davidlohr
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help