Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp502766imm; Thu, 21 Jun 2018 23:55:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIU1nhGj3yEuqI3W3dGFmA+VxoRFsKiPlZxtPA4StRnOfTmqeq/3DQjTbA0NablUij+Gbgx X-Received: by 2002:a65:42c2:: with SMTP id l2-v6mr300824pgp.237.1529650529714; Thu, 21 Jun 2018 23:55:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529650529; cv=none; d=google.com; s=arc-20160816; b=AUvChNRSLrt+twN7nGUx7Drxq6zC3MDlJblRxCkLGSPjvMLDP1xt0IiYxBnanu5OKN 9ZvR2AFtNOr6tkU8nukcrmycPcOcwJUOqDXrdZnjkz77GWs+gyGbWiCJPL13r+XHqwRv DuCXzsYobtoHMbnp+9TegAJjrGgAFLlgRvpCUC4Csa+djBAaVVNwWvx6pxbQorfR2s4+ JI0lsP8nBmsUzQQ/OTPiBCJpfriW8vuROF1shEKn2JRUfYaaxOpB4BQnFQSNeQKjQmr3 Bn3NYHnieeteJfK1me/6PBaNKCiAs+XW/w3WjDkpaou7W0wIQ53XptkmHP46rW49dVcV tBDQ== 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=NdoZ9rxsRqadpRZFJXH8f0BTFgSO6Q9sKKZJvujbHTI=; b=gWAvCkQswo0/7kHcn5IkTLH+RN4rzQqZRYOE7sZd23W/BJb3GMlxY00VdspHy7xCma Pdzuh1rNp0AigP8WimSf6TmjqZYanJFW15Fk5yvCyC/AoB9BkJPJRUlbI2GSbeOEYM7M 1luOWV0H8UqhqrTM4ZpTscTOXPZQDrfNQ6Cf1Dubj/1t4qkMt2XcNQj1sUbxAU2f+M5f 7ZvsUgdzklnLUFNuE9s1zYwkoA3wZSM1ArimOEFPUT6UaJem8sFJ8ZpQdz//6tTaOwZX KZHR8hkDsW7kxeinDzHANhJSuknOOESc0Y6ASdEX+3ozf5aUqvXCvSLortYIIygebRj/ xGdg== 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 j91-v6si6614259pld.402.2018.06.21.23.55.11; Thu, 21 Jun 2018 23:55:29 -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 S1751315AbeFVGyW (ORCPT + 99 others); Fri, 22 Jun 2018 02:54:22 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:37880 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751250AbeFVGyV (ORCPT ); Fri, 22 Jun 2018 02:54:21 -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 1fWFxS-00012U-UI; Fri, 22 Jun 2018 14:54:11 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1fWFxP-0003C6-Fw; Fri, 22 Jun 2018 14:54:07 +0800 Date: Fri, 22 Jun 2018 14:54:07 +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/4] lib/rhashtable: guarantee initial hashtable allocation Message-ID: <20180622065407.jqi3mvuzsj2jotbt@gondor.apana.org.au> References: <20180621212825.3059-1-dave@stgolabs.net> <20180621212825.3059-3-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180621212825.3059-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, Jun 21, 2018 at 02:28:23PM -0700, Davidlohr Bueso wrote: > rhashtable_init() may fail due to -ENOMEM, thus making the > entire api unusable. This patch removes this scenario, > however unlikely. In order to guarantee memory allocation, > this patch always ends up doing GFP_KERNEL|__GFP_NOFAIL > for both the tbl as well as alloc_bucket_spinlocks(). > > Upon the first table allocation failure, we shrink the > size to the smallest value that makes sense and retry with > __GFP_NOFAIL semantics. With the defaults, this means that > from 64 buckets, we retry with only 4. Any later issues > regarding performance due to collisions or larger table > resizing (when more memory becomes available) is the least > of our problems. > > Signed-off-by: Davidlohr Bueso Acked-by: Herbert Xu Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt