Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2167334imm; Mon, 28 May 2018 03:04:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoaeOvCi2OJPpEZvpEnLZJucrNI+s7uPmGsUZxjtUqrbaz0+VKg9mgzn22rtGxPa/tHouwV X-Received: by 2002:a17:902:c6b:: with SMTP id 98-v6mr13233093pls.270.1527501870068; Mon, 28 May 2018 03:04:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527501870; cv=none; d=google.com; s=arc-20160816; b=J7R+MdVsmv1caDTnlvJHzWjZXUHeEXDO2iS1uYyIeERYWNrF8wHMa1TBYZgQMnGZV0 MQktP/S7UXvRAfDlxgi0KfZD3DhT6+AjdXc0UO7/GEMmQCZzcUKi5k3r4Z3DJ41VqMeb IKTu8MpBLm1dnM9Uo/FdyKkC2Jg2lUAefNdHzdI8C8BsvcKsOyUQuRZ+MM+ujeVzsxgg RCixhO9k+HcGodMw/VmKyBHY5jF3cBvhSu+DCUpcHQ5O8B5iKq/GOU3VrUWlBUWsxH8G oMhpAGa9S4CJK8+pGQXqsZTLyNh5RrmosfrM/zXwtGQVjBARFthrv6gwti2C07UgXfAw yiog== 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=pTM7XXyaafi1LB0N917hpfXdefmfTSPNRFRckhS2SBw=; b=HfYjI+GJl4VrhXbnyp91igkFl06NS3hDPYUU3zCKcXrt9qRyZQrET3fQ88zfLGSHh/ c0izE3n4FfTPixhmmIFvrFXCD0ro4UO0tMQcLD9IvFjUBrCB82xRh4ioNE8W2Gh1kzh6 lxrrk+AGBafs1NW7aZlPaAj0a4SE3hrCu9ECW5n6ZLaQhfDcX0uSEDpODlcL/0Si3lYR Eb4WiznF7qxruHmios4zTKvyszfK9aYjYdw7mrZim3YKjavuS916NCGVUXaweJV3kGx1 GB/LoOgax8mtxspd7RZ/qDoauhH+cfWYr00xeks+jBvoMRKaSBHeNm9UsUHRqWFRTAGj RxRw== 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 g3-v6si23223024pgc.251.2018.05.28.03.04.06; Mon, 28 May 2018 03:04:30 -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 S1754333AbeE1KCu (ORCPT + 99 others); Mon, 28 May 2018 06:02:50 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:40966 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754200AbeE1KCr (ORCPT ); Mon, 28 May 2018 06:02:47 -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 1fNEzA-0002kc-Pj; Mon, 28 May 2018 18:02:40 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1fNEz7-0004lP-Jq; Mon, 28 May 2018 18:02:37 +0800 Date: Mon, 28 May 2018 18:02:37 +0800 From: Herbert Xu To: Davidlohr Bueso Cc: akpm@linux-foundation.org, torvalds@linux-foundation.org, tgraf@suug.ch, manfred@colorfullife.com, guillaume.knispel@supersonicimagine.com, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso Subject: Re: [PATCH 2/6] lib/rhashtable: guarantee initial hashtable allocation Message-ID: <20180528100237.needq2u5e3v2n642@gondor.apana.org.au> References: <20180524211135.27760-1-dave@stgolabs.net> <20180524211135.27760-3-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180524211135.27760-3-dave@stgolabs.net> 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 Thu, May 24, 2018 at 02:11:31PM -0700, Davidlohr Bueso wrote: > > + /* > + * This is api initialization and thus we need to guarantee the > + * initial rhashtable allocation. Upon failure, retry with a > + * smallest possible size, otherwise we exhaust our options with > + * __GFP_NOFAIL. > + */ > tbl = bucket_table_alloc(ht, size, GFP_KERNEL); > - if (tbl == NULL) > - return -ENOMEM; > + if (unlikely(tbl == NULL)) { > + size = HASH_MIN_SIZE; You should also take min_size into account. Yes I know the current code ignores it unless you also set nelem_hint. But that's just a bug. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt