Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1159653imm; Fri, 22 Jun 2018 11:19:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJRmzwTjiyoRvnEXyhM/9TBeOZ2WipWo7TkiNiibb8OOvfmanVjngBsdDALBtp9p9uK2MP+ X-Received: by 2002:a65:4a42:: with SMTP id a2-v6mr2354089pgu.367.1529691549464; Fri, 22 Jun 2018 11:19:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529691549; cv=none; d=google.com; s=arc-20160816; b=LTLF36FQ8JbElhJ2vThDdAYbJ9c/1pkxWSIKIA82jh3RQ2S/YQ7IFx9h00NrGDxSAq QxCQTCajxHJcKXTistbJVj1no8+L95R3barVzi/tAfbrKBME79zj8legRWStSF/LjHJw K94VVhagd//RPbQM8g+aU6WRBi2ky9g1DZ9wUZuOqYE2xJ6x1PPWXux0vIArrZs++glW nBUUai2ZEUV19/BubMmY9aaPJbJstrT20lc+XHEpsuCMopeyfwxE9GrG770+xQJMkcpR nNE1wSXzvBqFx5PbWWPT8bzqPigtO84Mskhn9nyLOCv0SeUN8pFc/1QEHTdqThfDeF2u jIrQ== 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=M4CyBNm/t+oHadjv+DyFLbYG6+uUADLDwoS1QjdeBU0=; b=dqfPfVjJItN41mlYAZwDUaYTz2FXrsE3NKnqj2lp0B2zMNrA6OVHY8bju02eJ05MBf wuK+6J2Gyk4h4puM+EtSNv3m3Byu+zd/SjnN2xblyqwbjNaiDqCNANX5B773k9Pvnrg8 UtygjiL7XW7jMNipUvr9zw+DYNgAMinPXhmiVKscWG6EqKcgOpflRbNsycmj19XEJCJV TU9Db4x/cuveSu4+NHbERHBknVRB1E3Ay+MO/zJCY1x1171xVCv/YqZMnRK7ry7BfTQq nQkehyUfistyN4jn8IR9NGKO/LbM6vLs+MrzskVk59hqa1EQt93oXSJvOu0hWb9TJRvt RDHQ== 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 b94-v6si8774870plb.135.2018.06.22.11.18.54; Fri, 22 Jun 2018 11:19:09 -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 S934117AbeFVSRB (ORCPT + 99 others); Fri, 22 Jun 2018 14:17:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:53053 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933508AbeFVSQ7 (ORCPT ); Fri, 22 Jun 2018 14:16:59 -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 90D0AAD11; Fri, 22 Jun 2018 18:16:58 +0000 (UTC) Date: Fri, 22 Jun 2018 11:16:54 -0700 From: Davidlohr Bueso To: akpm@linux-foundation.org, torvalds@linux-foundation.org Cc: tgraf@suug.ch, herbert@gondor.apana.org.au, manfred@colorfullife.com, mhocko@kernel.org, guillaume.knispel@supersonicimagine.com, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Davidlohr Bueso , neilb@suse.com Subject: Re: [PATCH v2 1/4] lib/rhashtable: simplify bucket_table_alloc() Message-ID: <20180622181654.evngae326rd5hr4n@linux-r8p5> References: <20180621212825.3059-1-dave@stgolabs.net> <20180621212825.3059-2-dave@stgolabs.net> <20180622181540.5gul4lx5dteqzzk3@linux-r8p5> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20180622181540.5gul4lx5dteqzzk3@linux-r8p5> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Cc'ing Neil. On Fri, 22 Jun 2018, Davidlohr Bueso wrote: >As of ce91f6ee5b3 (mm: kvmalloc does not fallback to vmalloc for incompatible gfp flag), >we can simplify the caller and trust kvzalloc() to just do the right thing. For the >case of the GFP_ATOMIC context, we can drop the __GFP_NORETRY flag for obvious reasons, >and for the __GFP_NOWARN case, however, it is changed such that the caller passes the >flag instead of making bucket_table_alloc() handle it. > >This slightly changes the gfp flags passed on to nested_table_alloc() as it will now >also use GFP_ATOMIC | __GFP_NOWARN. However, I consider this a positive consequence >as for the same reasons we want nowarn semantics in bucket_table_alloc(). > >Signed-off-by: Davidlohr Bueso >--- > >v2: >- Changes based on Neil's concerns about keeping nowarn flag. >- Better changelog. > > >lib/rhashtable.c | 7 ++----- >1 file changed, 2 insertions(+), 5 deletions(-) > >diff --git a/lib/rhashtable.c b/lib/rhashtable.c >index 9427b5766134..083f871491a1 100644 >--- a/lib/rhashtable.c >+++ b/lib/rhashtable.c >@@ -175,10 +175,7 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht, > int i; > > size = sizeof(*tbl) + nbuckets * sizeof(tbl->buckets[0]); >- if (gfp != GFP_KERNEL) >- tbl = kzalloc(size, gfp | __GFP_NOWARN | __GFP_NORETRY); >- else >- tbl = kvzalloc(size, gfp); >+ tbl = kvzalloc(size, gfp); > > size = nbuckets; > >@@ -459,7 +456,7 @@ static int rhashtable_insert_rehash(struct rhashtable *ht, > > err = -ENOMEM; > >- new_tbl = bucket_table_alloc(ht, size, GFP_ATOMIC); >+ new_tbl = bucket_table_alloc(ht, size, GFP_ATOMIC | __GFP_NOWARN); > if (new_tbl == NULL) > goto fail; > >-- >2.16.4 >