Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3622037imm; Tue, 29 May 2018 10:21:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoKoMze0dZhljt+2M3xwa3K2XfIwonHi/sSYeztlRDe/sN0fmrF1BPG20WE5umNcx0dfzwn X-Received: by 2002:a17:902:1e4:: with SMTP id b91-v6mr18274421plb.155.1527614472728; Tue, 29 May 2018 10:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527614472; cv=none; d=google.com; s=arc-20160816; b=TLvgSprL0fw8VRjo4UrL4PMDkmELBabSDkVSx7Y3XK5Kkfm+iuX6AJYlhRj97aizYW e+SN5FKZeK6LFFX8hOtg0UqiGfz7PO3l6s+OB+61uWIR/90jyHEIiO459O7kTq9Bzt0m CCqLNfoYk5tGnpWqGx6/nd+nQ85EYQc4JnN0H5DMK3hh0qOEeLRVak2JQw3S3vOBnNSI dnzFMJ61A/WV4nGrPxUKUstq8jDjjCKCiUNj2kM9KgHbeI0vm/3W0yq5rKFcqSrlco1M NtCm81aQmrwftY9mtUQNyyvvotjpjdtch3TlcoXIGspkIA/R1VDocHmQdjqYBnN9BoXv TVWg== 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=VT5Q0z55/ckw+u7Hd7qXzJRJ7fn0f5XX0yUbYVXkpdE=; b=QxtznlXF40iMvILf7MCKAkOreBFL7h17sEtqcfQofRBhHmxJNkBLBiyVYeOUBYVK7A uTS1hIUzL7fJDHNs68DmKvvA1GuxytF3zbQFAnJWwWOc73tEViVLUkUYlPb0o6yqCCh5 G0mQVU6p/0Dunt5pNs8ye+YPxctDXdJHQfeU+NH4N2Yts0pw2LhdqgiFDT+zAjoDa3s+ uy8T5QozTgEYmK3pbr5RK7yNYPsjybB1d5QfEEZyD87mi3fB2ZfmwaGKF2cc37132zzx 020AKzKla4q3aE9xZq/WcK7FG1dJ28082vKmXz0+2n9r7IVkMGOP0vLDJac8yvml4toW 30Ng== 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 f21-v6si25407845pgv.382.2018.05.29.10.20.57; Tue, 29 May 2018 10:21:12 -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 S965309AbeE2RU2 (ORCPT + 99 others); Tue, 29 May 2018 13:20:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:41669 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965154AbeE2RU1 (ORCPT ); Tue, 29 May 2018 13:20:27 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2237FAD4D; Tue, 29 May 2018 17:20:26 +0000 (UTC) Date: Tue, 29 May 2018 10:03:38 -0700 From: Davidlohr Bueso To: Herbert Xu 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: <20180529170338.7brp2m2k4gfqwf64@linux-n805> References: <20180524211135.27760-1-dave@stgolabs.net> <20180524211135.27760-3-dave@stgolabs.net> <20180528094956.zaxusqqju3wtbdcz@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20180528094956.zaxusqqju3wtbdcz@gondor.apana.org.au> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Davidlohr