Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3662874imm; Tue, 29 May 2018 11:07:04 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoGXcK0p9rcTQ45IeEVrK15q3a1pjeK/OKjwBYmufQD5cbeWPb+sUlhk88pBMLAEmujBehC X-Received: by 2002:a17:902:8bc4:: with SMTP id r4-v6mr18427175plo.381.1527617224463; Tue, 29 May 2018 11:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527617224; cv=none; d=google.com; s=arc-20160816; b=Im1+AAB7VOv72oBujIYScJMGCwtLyOeoQAvMWu+s08an4L/momvj9bIxvmrV48YuiJ KRlBYpHCGU7TmEAY03V7akFjVdhAZpg3i2UI+IMvQ2TxPRXJoweznX8vhodq/fLm2T1S 2cNn9aeuXujKEnlp9V+M3viJxkH+BR9lHBDGpyU8NwIk6oz4qPG/7OTxwHdoURMtm9la zaY0CTdjFL8Xze/PG6Pfdqr0VJQFWGvAsZ7t/Hhe1GfuRmSqUltZwWl/rz38vCbmDzzn rsx0BJYNYOxaAURB0BlJ3kwJSv0M/dtICGRM8hBy/Bv/wQs3rLGl2sr4/4BHVz5xYpML OV8g== 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=WDxxAAk8hwQrSlb2Eqjp2FVuxJwWyo6Ty36cWnzzJ4c=; b=Uka+jvBjd+ESOYvybKdGaqYrMWucj3lyz4vcG1HvGxmYvQETbWQhCWggzHv/6F5Abo 6VLjMvGnHZftNyK4c3xeMJERebZzGzsauNXfYu4lPGUrklvOHmgLLjaBPpxPtpbnDeV+ nqcd0ZkPQQM7XWmgeJWGiGd+nG/M1B+QnLzxZSEy3h6188oPoBIlXp5OrbBBfxyyWRu3 kQrIb2yyrQjEbWnfQNPEdbdsBEnSz5Kzt5jMGwuI5fwilNkSIzFLE/ipkMgmMQuA18KU 33w/QmOk0IYatxagdSCcZ/JbLn2k0fpMNg9hAuRdkMwpR3r8jjyFlGqhHrvI79i1VydZ tXXw== 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 t4-v6si33068505plb.313.2018.05.29.11.06.50; Tue, 29 May 2018 11:07:04 -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 S965884AbeE2SEm (ORCPT + 99 others); Tue, 29 May 2018 14:04:42 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:45348 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965603AbeE2SEi (ORCPT ); Tue, 29 May 2018 14:04:38 -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 1fNiyy-0003IQ-FY; Wed, 30 May 2018 02:04:28 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1fNiyy-0006PM-BI; Wed, 30 May 2018 02:04:28 +0800 Date: Wed, 30 May 2018 02:04:28 +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: <20180529180428.l6yt6ae4oxbgrja6@gondor.apana.org.au> References: <20180524211135.27760-1-dave@stgolabs.net> <20180524211135.27760-3-dave@stgolabs.net> <20180528094956.zaxusqqju3wtbdcz@gondor.apana.org.au> <20180529170338.7brp2m2k4gfqwf64@linux-n805> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180529170338.7brp2m2k4gfqwf64@linux-n805> 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 Tue, May 29, 2018 at 10:03:38AM -0700, Davidlohr Bueso wrote: > On Mon, 28 May 2018, Herbert Xu 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; > > > + > > > + tbl = bucket_table_alloc(ht, size, GFP_KERNEL); > > > + if (tbl == NULL) > > > + tbl = bucket_table_alloc_retry(ht, size, GFP_KERNEL); > > > + } > > > > Perhaps you should also explain here why we don't just try the > > minimum size with __GFP_NOFAIL as the second step rather than the > > third. > > Please see the comment above, I try to explain the rationale. It doesn't explain it at all. In fact I don't see why we neeed three attempts, just do the GFP_NOFAIL as the second and final step. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt