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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 01, 2018 at 10:41:31PM -0700, Davidlohr Bueso wrote:
> On Sat, 02 Jun 2018, Herbert Xu wrote:
> > >  	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.

Huh? The min_size is a floor for the hash table size.  Some users
may need it because they cannot tolerate the insert-time allocation
or failure.

Your use of min_t against min_size makes absolutely no sense.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux