Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1784654imm; Sat, 2 Jun 2018 08:54:27 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLHZ/a9heWj/ouKNdLY7B4X8OLiWDPWOjEvGp1ALa+rgWEoCOybxQB5dGFXAoV1q7P3qbdO X-Received: by 2002:a65:4c0e:: with SMTP id u14-v6mr11943951pgq.388.1527954867274; Sat, 02 Jun 2018 08:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527954867; cv=none; d=google.com; s=arc-20160816; b=MlTQtIDn2KNMZbgD1LFp4h39vqBQVyeZosvj8szX4U0yJrv9iMRyfszfDSt06d0QD5 cXsJN0m3JRSEtuBEKYhr/OBT5zYaqOXYI3mIagkX0/K7admgOtMmmbFwsbO0oqQDCC+h jvi3WFOA6znVBrVoNn2lURLYzcmQ4z/okRuoEvjgLMufDrlyvow236pduxeoLT+Aqq/t hGh4obyXU9fl053Jj9LINI2viaHy9A97zKWaD6k/1WHAoUlkjfhlyJegO0eWOBQSYBcn OBaNwj5CT03yWxnS4wZhJFjg/pU90Ja2MANSKq5ygKBhyywImnL/PFDDJMmzuNPkt+5G GRTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ELvdPria5A/WpBWNJ/k/f+9BdNPc8yakBcCLJ0W0Mfo=; b=HHpvjEOrlNa3uG4xTprU4YIqbx2EdE1s0u+ZoXSPIchT9r34ookvgmkN7ZehD+OZEM 0jCO7hy1k0ABsd9mcO3e3/ZD2uuYob42V4WRkMedspkjxtJjmbtR3eBy3ivnZ/lI7fSj RlW1mkX1ud8DFriOFItoYe26ZNnzXF9KUzi3SxT+UYGYejPIB60Gv7tsaZVGB0j5mVax 635Ea6ZjMi+FwUWrT813asRgAVeWsm6gyX2yoXQdR8amPH5SmILE9c90d2YwobapVCs1 sOhizAxy1uIelFb+44mDZThNDq1UW1o0xWEDsVYclGTHb42BxhfMIuzDW2ReeuAKpDeB 5WYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3-v6si41951517plc.14.2018.06.02.08.54.12; Sat, 02 Jun 2018 08:54:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751782AbeFBPxl (ORCPT + 99 others); Sat, 2 Jun 2018 11:53:41 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:59062 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751376AbeFBPxk (ORCPT ); Sat, 2 Jun 2018 11:53:40 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1fP8qO-0000aE-EE; Sat, 02 Jun 2018 23:53:28 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1fP8qK-0002mR-Mk; Sat, 02 Jun 2018 23:53:24 +0800 Date: Sat, 2 Jun 2018 23:53:24 +0800 From: Herbert Xu To: Davidlohr Bueso 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: <20180602155324.yrco4xq2yeez2btg@gondor.apana.org.au> References: <20180601160125.30031-1-dave@stgolabs.net> <20180601160125.30031-3-dave@stgolabs.net> <20180602044150.xpazuhpxbwt37xmu@gondor.apana.org.au> <20180602054131.ta7ligrfwbgvemfv@linux-r8p5> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180602054131.ta7ligrfwbgvemfv@linux-r8p5> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt