From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751378AbeFBFlo (ORCPT ); Sat, 2 Jun 2018 01:41:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:38580 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750750AbeFBFll (ORCPT ); Sat, 2 Jun 2018 01:41:41 -0400 Date: Fri, 1 Jun 2018 22:41:31 -0700 From: Davidlohr Bueso To: Herbert Xu Cc: akpm@linux-foundation.org, torvalds@linux-foundation.org, tgraf@suug.ch, manfred@colorfullife.com, mhocko@kernel.org, guillaume.knispel@supersonicimagine.com, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH 2/5] lib/rhashtable: guarantee initial hashtable allocation Message-ID: <20180602054131.ta7ligrfwbgvemfv@linux-r8p5> References: <20180601160125.30031-1-dave@stgolabs.net> <20180601160125.30031-3-dave@stgolabs.net> <20180602044150.xpazuhpxbwt37xmu@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20180602044150.xpazuhpxbwt37xmu@gondor.apana.org.au> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Davidlohr