Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2027988imm; Thu, 12 Jul 2018 11:55:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfCdJVQJIhtLrWSmOvbMZa3Yxa4RsDRcB5/5ltDpLrqTosaaHl5jgXtL6e7HvmJuusbyR5Y X-Received: by 2002:a63:c902:: with SMTP id o2-v6mr3186446pgg.118.1531421726230; Thu, 12 Jul 2018 11:55:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531421726; cv=none; d=google.com; s=arc-20160816; b=SMaBJUxYurk40aGH7bsaUfVYZW4aCnriW5ceVNfSm4vUffQG+F42+mmuejgDYfDOfc dg3zL9qUIUoolKz/YFCV4jsTD7z6ukQrGXn0z07dSItGyvLTSECqIyvwbWPwKztEPis0 7QCDNVLN3e2KyHSvYSZZenwUx+fnFYfOpJko655TXphtVMAfBlGO+nwlvb5Fh2FVpvLO rWWN/3PXmY5J8tlW6P6/e+VS0V6Rp+9dnk6iOhalFo3WxGyHxwI+A1cbgp2O6wIZmLgo aJTAs4EDQY0qIGx9eBBgc1+5wBmqic3NBlM2DfZGWxv+3efRmv+V2errvjVR6IMMHZWU hQOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=oFHl/qb6kt+BdQRH7snwxI9/D15UmrVQxZQdfewdXGc=; b=Lp3+JR3gpk8ymnfBpo5U8CFl1SG1D3SgA0lv6YhAGDxL0fTrdJzhDnq8/leheAA968 ob2RXD48ua4d5+7pmF5bJp5AvKyS698JqyWaW0H7IfrVXh1fNTd2jUUBVLME27TFbtj9 L05Wtu7qyYMXIBxA4T3OlTAXAxlOevS+SBpQVNXURfQnt/HsGXeMPHr0y5IEuyUgjOSR MpI19MPr05jFqNiAHFuqyzQphvlN4T37v1apkeLr2ZqkkMWcReq2yWTBH7V8kfWtY9rG rPPWKIdzAMFeN/AWaDPH2pHsxyNbWoJoeRuvtQFyvPjoBVr8b1bDrc8ZRXSbtMTvhZHv EQBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@colorfullife-com.20150623.gappssmtp.com header.s=20150623 header.b=t8QY0eld; 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 a5-v6si24083123pll.412.2018.07.12.11.55.11; Thu, 12 Jul 2018 11:55:26 -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; dkim=pass header.i=@colorfullife-com.20150623.gappssmtp.com header.s=20150623 header.b=t8QY0eld; 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 S1732298AbeGLTEE (ORCPT + 99 others); Thu, 12 Jul 2018 15:04:04 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42785 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726506AbeGLTEC (ORCPT ); Thu, 12 Jul 2018 15:04:02 -0400 Received: by mail-wr1-f67.google.com with SMTP id e7-v6so3163612wrs.9 for ; Thu, 12 Jul 2018 11:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=colorfullife-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=oFHl/qb6kt+BdQRH7snwxI9/D15UmrVQxZQdfewdXGc=; b=t8QY0eld8yNUuANaSptk8e3g/o3f3BIBxDklLRi/kOHzmux3CIjCkgr3lEnHDSqr6C jju+2nEVWAp5TGvJyJiWxecRK5Pz9DXiJ3VAxtuhLztwGdoWusFQ8m2ALGIwwBk5b8P7 4c5RKiBSo6To4Kto9h40RdHPZZ96t2Xf4E6bx+rL0Fv8bFr6vFvBjKs4yvH4mC8c+8r1 rX/Vsi6/Yrl0mBU94dHmbxUee6AY7rG85aof7jlXAGVsZzdrGxsn2/Mcrjx/1UuxDQTy /OMTVRlf9fSUiYgsP8hvNI8XwD0eWDFMAXquhb0uF4UarDu1s4IlVMvBjZxc+OtQJsym Z7lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=oFHl/qb6kt+BdQRH7snwxI9/D15UmrVQxZQdfewdXGc=; b=lwyiZURqxWKl6sZDM31ibhR/TkGKix6PTtIAAUB6zEpOeZdVQoS1xYNRzsYHNcPaVS 1Oh+7m/E/Kv9LLoejkpU3HI5SNlSpHShAT3DX8ppvc1QrJgp/F5vFZMt+WK5XaCeNS5R fdpRpiydJefJtQPir+o9dqZflfaBbLI5AdTfJsRePb2gFpdR2BT4F6hZSXSs9nUMpzER fQ19+fLxG6k5g42OnllslkTfPQP/ATIKM9el5/UO7HCg6C5DD8PrW4ACvXVCxwk4E2Lf j2qwc3TG6Z5zMgRWk5xilfDyJiIx7b4sp1fIjEiWd7BivCpDeLLk6MAcXHr459q+xD1v O3Dg== X-Gm-Message-State: AOUpUlGxsy2c4DSwYSs0NzoYE43KPxBbtdoQAu9I/R6TRn88cEls0oy3 WVq7TdJLX3woSoNIojLPi98O9g== X-Received: by 2002:adf:9086:: with SMTP id i6-v6mr89210wri.271.1531421593019; Thu, 12 Jul 2018 11:53:13 -0700 (PDT) Received: from localhost.localdomain (p200300D993C98700CB5FA3798C189FE1.dip0.t-ipconnect.de. [2003:d9:93c9:8700:cb5f:a379:8c18:9fe1]) by smtp.googlemail.com with ESMTPSA id h5-v6sm13557841wrr.19.2018.07.12.11.53.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 12 Jul 2018 11:53:12 -0700 (PDT) From: Manfred Spraul To: Andrew Morton , Davidlohr Bueso , Dmitry Vyukov Cc: LKML , 1vier1@web.de, Kees Cook , Davidlohr Bueso , Manfred Spraul Subject: [PATCH 07/12] lib/rhashtable: simplify bucket_table_alloc() Date: Thu, 12 Jul 2018 20:52:36 +0200 Message-Id: <20180712185241.4017-8-manfred@colorfullife.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180712185241.4017-1-manfred@colorfullife.com> References: <20180712185241.4017-1-manfred@colorfullife.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Davidlohr Bueso As of commit ce91f6ee5b3b ("mm: kvmalloc does not fallback to vmalloc for incompatible gfp flags") 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 Acked-by: Michal Hocko (commit id extended to 12 digits, line wraps updated) Signed-off-by: Manfred Spraul --- 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.17.1