Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp184860imm; Thu, 31 May 2018 21:55:48 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI9109nU83rTCgAWuAtzfRYE3WI4ek0bCQsu9BqeUEJgYKzEkno5ulj8YAoCsNIw2ZiAqFA X-Received: by 2002:a62:3b5d:: with SMTP id i90-v6mr9577393pfa.24.1527828948121; Thu, 31 May 2018 21:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527828948; cv=none; d=google.com; s=arc-20160816; b=UXUR2HaS5ugmm10NJGe8icvoN7uKYxFueXIVR1Xc0hgdXHJ3M/uZMcyvh9xjKzvM3M QAXuvz2MwK9Mly9e+cYaZGEoY2H6oF1oa/9/nHcH1UUlN6VndfB9yi/sjuAIlf47GP// Efa7ezz4bEvzs+HhhgH6hjjFPSeHlPY4mglXuyPqjOnsHFY0B6WIb2FdBEmeattH0+FV pHIMUNmzTUlPijT99VOgVO0KSGImayHkl6gFkRTOIHfFXIKHsoifwCzGujoCYxJ79dSZ zwp5kLY+fRrO/DO2W3AqKy+NCZwe/xGqO27h9khlGPNRDLQxiBS/A+CU5Qt9Ch2QxA6y EUdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:cc:subject:date:to :from:arc-authentication-results; bh=CQalzG6bJVD7ZokHc2gtMTfavvYfWnQA9W9ioZ6gcPo=; b=rENM0cqaYXw+VhR8s2WADYc2Q8lLbyd/Y4kpjDlnFyrkGJOsbfY4LF5IkqroVb80RC S+3JX1Rno1/KujyRK2+btRmwCr7kxftLYugnKb1dbmDfgQrpQzBYv1vxjTfUDv31ZQ5D vZPn46aa9qkXiiCMU26F1P6qOzSZLPXvtRTbGSO7oapYg9yLOIUMNLeYQYrk3HgJtV3b 7o+nsEb4gG7SQAe/x17tjNDJdLCFWV6WqJ/GuXCvEaKbmDZV/6V/LTVS6UVwAbKF0HiH yhdmfdp9+sBwIRwWcSZPwFILPj5aggrVCsi0CgOJ0GrLUi+2YAAygr0VxOXDSsubHtiW R4Gg== 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 t5-v6si10144340pgu.305.2018.05.31.21.55.03; Thu, 31 May 2018 21:55:48 -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 S1751388AbeFAEpl (ORCPT + 99 others); Fri, 1 Jun 2018 00:45:41 -0400 Received: from mx2.suse.de ([195.135.220.15]:34047 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751206AbeFAEpg (ORCPT ); Fri, 1 Jun 2018 00:45:36 -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 2176BAD02; Fri, 1 Jun 2018 04:45:35 +0000 (UTC) From: NeilBrown To: Thomas Graf , Herbert Xu Date: Fri, 01 Jun 2018 14:44:09 +1000 Subject: [PATCH 05/18] rhashtable: simplify INIT_RHT_NULLS_HEAD() Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <152782824947.30340.2254332178823222989.stgit@noble> In-Reply-To: <152782754287.30340.4395718227884933670.stgit@noble> References: <152782754287.30340.4395718227884933670.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 'ht' and 'hash' arguments to INIT_RHT_NULLS_HEAD() are no longer used - so drop them. This allows us to also from the nhash argument from nested_table_alloc(). Signed-off-by: NeilBrown --- include/linux/rhashtable.h | 2 +- lib/rhashtable.c | 17 +++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index 25d839881ae5..49f80506d02e 100644 --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h @@ -77,7 +77,7 @@ struct bucket_table { #define RHT_NULLS_MARKER(ptr) \ ((void *)NULLS_MARKER(((unsigned long) (ptr)) >> 1)) -#define INIT_RHT_NULLS_HEAD(ptr, ht, hash) \ +#define INIT_RHT_NULLS_HEAD(ptr) \ ((ptr) = RHT_NULLS_MARKER(&(ptr))) static inline bool rht_is_a_nulls(const struct rhash_head *ptr) diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 69f05cf9e9e8..8582e1916c2d 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c @@ -116,8 +116,7 @@ static void bucket_table_free_rcu(struct rcu_head *head) static union nested_table *nested_table_alloc(struct rhashtable *ht, union nested_table __rcu **prev, - unsigned int shifted, - unsigned int nhash) + unsigned int shifted) { union nested_table *ntbl; int i; @@ -130,8 +129,7 @@ static union nested_table *nested_table_alloc(struct rhashtable *ht, if (ntbl && shifted) { for (i = 0; i < PAGE_SIZE / sizeof(ntbl[0].bucket); i++) - INIT_RHT_NULLS_HEAD(ntbl[i].bucket, ht, - (i << shifted) | nhash); + INIT_RHT_NULLS_HEAD(ntbl[i].bucket); } rcu_assign_pointer(*prev, ntbl); @@ -157,7 +155,7 @@ static struct bucket_table *nested_bucket_table_alloc(struct rhashtable *ht, return NULL; if (!nested_table_alloc(ht, (union nested_table __rcu **)tbl->buckets, - 0, 0)) { + 0)) { kfree(tbl); return NULL; } @@ -207,7 +205,7 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht, tbl->hash_rnd = get_random_u32(); for (i = 0; i < nbuckets; i++) - INIT_RHT_NULLS_HEAD(tbl->buckets[i], ht, i); + INIT_RHT_NULLS_HEAD(tbl->buckets[i]); return tbl; } @@ -1194,7 +1192,7 @@ struct rhash_head __rcu **rht_bucket_nested(const struct bucket_table *tbl, if (!ntbl) { if (!rhnull) - INIT_RHT_NULLS_HEAD(rhnull, NULL, 0); + INIT_RHT_NULLS_HEAD(rhnull); return &rhnull; } @@ -1219,7 +1217,7 @@ struct rhash_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht, nhash = index; shifted = tbl->nest; ntbl = nested_table_alloc(ht, &ntbl[index].table, - size <= (1 << shift) ? shifted : 0, nhash); + size <= (1 << shift) ? shifted : 0); while (ntbl && size > (1 << shift)) { index = hash & ((1 << shift) - 1); @@ -1228,8 +1226,7 @@ struct rhash_head __rcu **rht_bucket_nested_insert(struct rhashtable *ht, nhash |= index << shifted; shifted += shift; ntbl = nested_table_alloc(ht, &ntbl[index].table, - size <= (1 << shift) ? shifted : 0, - nhash); + size <= (1 << shift) ? shifted : 0); } if (!ntbl)