From patchwork Fri Jun 9 15:13:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13274100 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ECB8E18C05 for ; Fri, 9 Jun 2023 15:13:53 +0000 (UTC) Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62E32210C for ; Fri, 9 Jun 2023 08:13:52 -0700 (PDT) Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-39c84863e7cso648873b6e.1 for ; Fri, 09 Jun 2023 08:13:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20221208.gappssmtp.com; s=20221208; t=1686323631; x=1688915631; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DSK20+cmPdvbepJqQyD3omQ1jTT5Y4rR/Dah7tvJKjU=; b=m3BT3PO5glf/ESqSsGnPyMKB5uglucucpRlhPpvAe3CcPv3LLEyBKpuONaslS59yf5 P/SRpthMNuAn/P/AV6vWK0Af9KpDsjkqmpr7ftXrDNF6ya44gtYhyLm1gcbZNygUrvRq qMKFOYjCoRgDaUoT0OEtdFx4/EV2ZqojtUPzJmN1uGBuzu2V4lsVjADs8YjXmRkBdSF1 TROvntBT9V8+cVwaq2OZF1cvdqprK1k0m3ZZ1UFTU2BnpwUfbI5BTsthum7whhKNSu25 pLw3j9J082KvheuLbD2f9QRMs45tTBikksW0ksUOXXCVUvS/F4y61E7cGIz/eAPkAAtc 6gWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686323631; x=1688915631; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DSK20+cmPdvbepJqQyD3omQ1jTT5Y4rR/Dah7tvJKjU=; b=EGg/1TkkEoy/+j1mkxL3CvbbxQmpjnDtka4mnPYnQ0pwOT0G4PQ5JUGPtCTbU6RrxZ M+s0ItB7kqygHxlV7B7X1ulYnv3pCd6ij9NNc2jIRcKy6J+nbZEGGm/w+Z83pxJ/mdct EmfqU05V/LIJBU3EdAvD3evoNYJKCSoTFdfS7TiygwhuDIKAkNGuguYTdMvvP349XfnA fwHpndoQOXfWtVYUebqYpZWrnoA5y5SETMO+uzOnKXw/Fgw0CMzzcx0D0nSSDZnyDQ+g 4KHN7R+zV0Yg5fw5fLNuYk53kDsefzq9ysrJM5993KLDrNqYxnLuOY2QPjs9r01mHTVI MTFw== X-Gm-Message-State: AC+VfDzac647IuhB9nOnGG7WWiTNdiS+V5E+J/97G7TUWyawJo9va04W w56Cd5Qu5zuE5E87nbuG1BRKtmD1ZDzqRSxkOt0= X-Google-Smtp-Source: ACHHUZ7Zb/d8qekC/JsEwOir+iFcDhiJ3qd+t8zYZC9rDY7SLSsrpqvbSRkha7FQBp0GfMzvV0hJ+g== X-Received: by 2002:a05:6808:1529:b0:39a:ba7e:33bd with SMTP id u41-20020a056808152900b0039aba7e33bdmr2269679oiw.0.1686323629912; Fri, 09 Jun 2023 08:13:49 -0700 (PDT) Received: from rogue-one.tail33bf8.ts.net ([2804:14d:5c5e:44fb:643a:b27d:4a69:3b94]) by smtp.gmail.com with ESMTPSA id z2-20020aca3302000000b0038ee0c3b38esm1536449oiz.44.2023.06.09.08.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 08:13:49 -0700 (PDT) From: Pedro Tammela To: netdev@vger.kernel.org Cc: tgraf@suug.ch, herbert@gondor.apana.org.au, davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Pedro Tammela Subject: [RFC PATCH net-next 1/4] rhashtable: add length helper for rhashtable and rhltable Date: Fri, 9 Jun 2023 12:13:29 -0300 Message-Id: <20230609151332.263152-2-pctammela@mojatatu.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230609151332.263152-1-pctammela@mojatatu.com> References: <20230609151332.263152-1-pctammela@mojatatu.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Instead of having users open code the rhashtable length like: atomic_read(&ht->nelems) Provide a helper for both flavours of rhashtables. Signed-off-by: Pedro Tammela --- include/linux/rhashtable.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h index 5b5357c0bd8c..aac803491916 100644 --- a/include/linux/rhashtable.h +++ b/include/linux/rhashtable.h @@ -1283,4 +1283,20 @@ static inline void rhltable_destroy(struct rhltable *hlt) return rhltable_free_and_destroy(hlt, NULL, NULL); } +/** + * rhashtable_len - hash table length + * @ht: the hash table + * + * Returns the number of elements in the hash table + */ +static inline int rhashtable_len(struct rhashtable *ht) +{ + return atomic_read(&ht->nelems); +} + +static inline int rhltable_len(struct rhltable *hlt) +{ + return rhashtable_len(&hlt->ht); +} + #endif /* _LINUX_RHASHTABLE_H */ From patchwork Fri Jun 9 15:13:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13274101 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CFC911952B for ; Fri, 9 Jun 2023 15:13:54 +0000 (UTC) Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E4921FEB for ; Fri, 9 Jun 2023 08:13:53 -0700 (PDT) Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-39c7f7a151fso654887b6e.0 for ; Fri, 09 Jun 2023 08:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20221208.gappssmtp.com; s=20221208; t=1686323632; x=1688915632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zqUtzMv9176eVmaGGpavOuZ/bRr8DznLogOIZDXKbuk=; b=gh1Cy2/LWH6TMihQKqdzE2eAXcVS9qSUUaL5D1jn9Lnm6QeM2RaUTbVXMVrlTEcsIw dBAaM+ArEq6+qXtOMYfC01tgZO7WX6GEAdkKAQLHRw8G6nbFTqobSOXgIJgs4C7ohXp5 zeeuAp2rR0OBT5cBuXvuwR1o/SmT78l3LusnR+d1/6YrlpKl/cVc237CLiRxm/5MaMsR tUCxJT+woGZvlEPWiEJleQkr0aDDTnupDdf5thi0JTUVwscphMW1X29WGq4FN1cX1UWa fVqB271QewQAE7CpIURRdT6nPbPca3Vc1EFeWsJuKPHCnxf77Wr+AreqdUTFW28+VwuA ss5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686323632; x=1688915632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zqUtzMv9176eVmaGGpavOuZ/bRr8DznLogOIZDXKbuk=; b=AmnvcikERKCtIL1mSMXanUEFnHYofvTnpnzJonnz7W3UEttf3HOSS9BqREPG/PyPOC YgNHTEbHmkYAkTkj2VdGSmJcnZoYYKeO0OrfogAzPGQAh+uBHtxA+Usml/9dTA4lMz3U 7W2jiSbaS64recwc54v/+Fh6B1cqAPecvdDU7LGHwaU8mDDRBd5YH2zKEpRCFbHokpy/ ab6Y3GTSFZnm5D35MRcbSIeLJALO0pC1RKc2QgjF7DDhN8q8ma+w4B04Q136It1eBZJN bcdMbhEPOgkcadflpBYfCGM0sO1S0+BRLJRcqmXeKiF4qSYgqz8qKQn/R8lnhLkUwGqJ SeiA== X-Gm-Message-State: AC+VfDyKUOAV8fXDjIsODd7sFxMxQYtn3+/uVjV+yJPcDeI7ChrheE+3 bjHLIYFmOw6a3Jr81AwDUmu3WlUvNtMByYAc2D8= X-Google-Smtp-Source: ACHHUZ4QOhXsshrZWGRNmpetK7tvidgyf/3hR5jUdGIunaYtUeWIsM1WeMsegDi1kVcokHxZVgPC/A== X-Received: by 2002:a05:6808:349:b0:398:850:6206 with SMTP id j9-20020a056808034900b0039808506206mr1876733oie.27.1686323632609; Fri, 09 Jun 2023 08:13:52 -0700 (PDT) Received: from rogue-one.tail33bf8.ts.net ([2804:14d:5c5e:44fb:643a:b27d:4a69:3b94]) by smtp.gmail.com with ESMTPSA id z2-20020aca3302000000b0038ee0c3b38esm1536449oiz.44.2023.06.09.08.13.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 08:13:52 -0700 (PDT) From: Pedro Tammela To: netdev@vger.kernel.org Cc: tgraf@suug.ch, herbert@gondor.apana.org.au, davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Pedro Tammela Subject: [RFC PATCH net-next 2/4] rhashtable: use new length helpers Date: Fri, 9 Jun 2023 12:13:30 -0300 Message-Id: <20230609151332.263152-3-pctammela@mojatatu.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230609151332.263152-1-pctammela@mojatatu.com> References: <20230609151332.263152-1-pctammela@mojatatu.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Use the new length helpers instead of open coding the length read Signed-off-by: Pedro Tammela --- lib/rhashtable.c | 2 +- lib/test_rhashtable.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 6ae2ba8e06a2..1f8ca27af853 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c @@ -390,7 +390,7 @@ static int rhashtable_rehash_alloc(struct rhashtable *ht, static int rhashtable_shrink(struct rhashtable *ht) { struct bucket_table *old_tbl = rht_dereference(ht->tbl, ht); - unsigned int nelems = atomic_read(&ht->nelems); + unsigned int nelems = rhashtable_len(ht); unsigned int size = 0; if (nelems) diff --git a/lib/test_rhashtable.c b/lib/test_rhashtable.c index c20f6cb4bf55..5853b83d9ad1 100644 --- a/lib/test_rhashtable.c +++ b/lib/test_rhashtable.c @@ -199,9 +199,9 @@ static void test_bucket_stats(struct rhashtable *ht, unsigned int entries) rhashtable_walk_exit(&hti); pr_info(" Traversal complete: counted=%u, nelems=%u, entries=%d, table-jumps=%u\n", - total, atomic_read(&ht->nelems), entries, chain_len); + total, rhashtable_len(ht), entries, chain_len); - if (total != atomic_read(&ht->nelems) || total != entries) + if (total != rhashtable_len(ht) || total != entries) pr_warn("Test failed: Total count mismatch ^^^"); } From patchwork Fri Jun 9 15:13:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13274102 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 772B51991B for ; Fri, 9 Jun 2023 15:13:57 +0000 (UTC) Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A7B61FF3 for ; Fri, 9 Jun 2023 08:13:56 -0700 (PDT) Received: by mail-oi1-x22d.google.com with SMTP id 5614622812f47-39c7f78c237so681049b6e.3 for ; Fri, 09 Jun 2023 08:13:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20221208.gappssmtp.com; s=20221208; t=1686323635; x=1688915635; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QM5JDAuNZuAnLZxiWDER0g18nXNzg7qD4OHp9FyblC4=; b=SSNZJBlayjEBT9BCH6Md6blZYczAvD37fBYc2wwrOw3KVAFHRG53D2fe4Otp0btOpE Kzkf8qWH6MZSRO5XWPcpywifFTLhqxDmhb4KV5Gx5QFMuV2TRwnMH3ujru4AcKJMqYEj NkcMaUIZTuYBNdKswaq5FQejQpYmufG2sYHWHPIfNQHxdjTT5xcakNDXeA3l7wG9g6C6 6JjiPIP0CNzXDeGGHcn+6vSX8V/8PoepeqwZoU7uo3Q2kwacwhPMg63KgDMiFSJuJTWR 1ugJPi+h0kJJXg7QOrhdgjakethfMiy6d2d7jlJwVywO2447o9235eo2tYLsHgwtVRit KDkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686323635; x=1688915635; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QM5JDAuNZuAnLZxiWDER0g18nXNzg7qD4OHp9FyblC4=; b=iyD4Kgwf/s9QbIResDlYdFNgIFxB8HBhLPlx9MlOCk5il5kzM3ifXcXTXc9ZW+qPeo o5eF/CHFZvK00ZD3M7p0vNG9glqR2fze0leEfJ2xxH67P8apIa7J1+hZWyuM6Kro/dqJ 4zeuTb9ZW5w+aHvcZIfTIsVA1ONZ7AiKm2JIUb/i1pa0BmVxA1cplByo6PUefkIamtp1 Mt+w42dUzL4AkcG4jpS3aj9N73Kv4vtZ6mT1OeWRv7MLnuH2QoC7jIO8jnW3G1pyU6l+ 3Pj2PHe1Oj78FJVFd1/GSK7O7mOr2s5feQ39jvzyd8dmos/bKonHh2DZUEcoQ5XpRlIb cRVQ== X-Gm-Message-State: AC+VfDxuMQwYLW2GXYPtunkXhHoM7fifr55ny1eFwYe7pZt0JLYaPUt5 ADpny7C5fFmGpg6GnzXkdZXY8VakKnCcLNhRYv8= X-Google-Smtp-Source: ACHHUZ4wfkiCdGtng7QaS48b7Y4W6ccrypBFPDYWYMfflLzIXnzXxRHwSOmakjPgWj4PAV2NGebp2w== X-Received: by 2002:a05:6808:114d:b0:39a:bc5c:f265 with SMTP id u13-20020a056808114d00b0039abc5cf265mr2476709oiu.28.1686323635299; Fri, 09 Jun 2023 08:13:55 -0700 (PDT) Received: from rogue-one.tail33bf8.ts.net ([2804:14d:5c5e:44fb:643a:b27d:4a69:3b94]) by smtp.gmail.com with ESMTPSA id z2-20020aca3302000000b0038ee0c3b38esm1536449oiz.44.2023.06.09.08.13.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 08:13:55 -0700 (PDT) From: Pedro Tammela To: netdev@vger.kernel.org Cc: tgraf@suug.ch, herbert@gondor.apana.org.au, davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Pedro Tammela Subject: [RFC PATCH net-next 3/4] net/ipv4: use rhashtable length helper Date: Fri, 9 Jun 2023 12:13:31 -0300 Message-Id: <20230609151332.263152-4-pctammela@mojatatu.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230609151332.263152-1-pctammela@mojatatu.com> References: <20230609151332.263152-1-pctammela@mojatatu.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Avoid open coding the rhashtable length read Signed-off-by: Pedro Tammela --- net/ipv4/proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index eaf1d3113b62..cab1edc3c416 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c @@ -42,6 +42,7 @@ #include #include #include +#include #define TCPUDP_MIB_MAX max_t(u32, UDP_MIB_MAX, TCP_MIB_MAX) @@ -69,7 +70,7 @@ static int sockstat_seq_show(struct seq_file *seq, void *v) seq_printf(seq, "RAW: inuse %d\n", sock_prot_inuse_get(net, &raw_prot)); seq_printf(seq, "FRAG: inuse %u memory %lu\n", - atomic_read(&net->ipv4.fqdir->rhashtable.nelems), + rhashtable_len(&net->ipv4.fqdir->rhashtable), frag_mem_limit(net->ipv4.fqdir)); return 0; } From patchwork Fri Jun 9 15:13:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Tammela X-Patchwork-Id: 13274103 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDE0E256D for ; Fri, 9 Jun 2023 15:14:01 +0000 (UTC) Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AD982113 for ; Fri, 9 Jun 2023 08:14:00 -0700 (PDT) Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-392116b8f31so666474b6e.2 for ; Fri, 09 Jun 2023 08:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20221208.gappssmtp.com; s=20221208; t=1686323639; x=1688915639; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fG+z5pDu0L2aUS+EwfGH/j31mJRBKgw/abvuWFuc9sQ=; b=DzcdcTUKESOM1ePlDTRa2oCGGUmnlJUXzw94qKPEo2jw9M1BVSYY9fmhrHGUjUqX/u YYTGdimahyOztLLXrfKNrk9xn8wN4K+NOkR6dHEFFd/pt2k2niGcUQFtZ+F0Dc9gcmO5 z++FqMsp49aFevEco56/+Am5bhA5613EPwiz3zoJjYud16xezBRh2411JopRd6PJ1HLP KKard7Fc5d1O40s/T0fOMae48wEEIYYyA8c8VIR4dPxqudntaibeuWCXk1ESgK+1wgVW 5E9ytJnBQ6pNwbVlqQIIjxiQ+KOSDornxLFqqxnlathKJx6OsKe8U9x9q4zoxD/teQuj eAxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686323639; x=1688915639; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fG+z5pDu0L2aUS+EwfGH/j31mJRBKgw/abvuWFuc9sQ=; b=bd6xKLrg/OdUPrN6snk5HSAZ601aU0k1qzlbtBBVemX89ilvXJng/xp3LRkahSm404 BuwVwn2R+6/ADvOz9G0fl5JaZp1fHkDqeQDx8q0dk+kHHizhtXsxwZLfJPAy2pWi1iZC 7/s0Z3lJeue7syHDgq7/WFQzoKcjlRVhj78GIgv4pOkv5f399jJtpnBqRarMJ2nD3iaA VWHqSQbY0ciUYYxJ7aYtJ5w7g4xKH/tz3++6qyXTuD88ad3KObLUzNV66GPZOXC/v9GO 4KvV4k9/7Rbengu7F0TIH8qLdyCYGo1dPvPN19WHIs1D+fZQ84LpBWHda2WVAC2fFhAi NPiA== X-Gm-Message-State: AC+VfDwolZaq4MczKTd8TAEkWjlhYsp25KnBElFOhwlIOdB0vtFygfk4 QYt6eW9G5jO7HrMd8nuQ/qxjY7Xjz2tL/W5wzLs= X-Google-Smtp-Source: ACHHUZ4Sx8GQIGHQMGR/vofb1dcbBX1IB9dlqdPNb+hC/HpWeV0V9drPKj2QzCoK6xn+KZAZXGj6pg== X-Received: by 2002:a05:6808:3b5:b0:39b:da91:8749 with SMTP id n21-20020a05680803b500b0039bda918749mr1608793oie.50.1686323637937; Fri, 09 Jun 2023 08:13:57 -0700 (PDT) Received: from rogue-one.tail33bf8.ts.net ([2804:14d:5c5e:44fb:643a:b27d:4a69:3b94]) by smtp.gmail.com with ESMTPSA id z2-20020aca3302000000b0038ee0c3b38esm1536449oiz.44.2023.06.09.08.13.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 08:13:57 -0700 (PDT) From: Pedro Tammela To: netdev@vger.kernel.org Cc: tgraf@suug.ch, herbert@gondor.apana.org.au, davem@davemloft.net, dsahern@kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Pedro Tammela Subject: [RFC PATCH net-next 4/4] net/ipv6: use rhashtable length helper Date: Fri, 9 Jun 2023 12:13:32 -0300 Message-Id: <20230609151332.263152-5-pctammela@mojatatu.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230609151332.263152-1-pctammela@mojatatu.com> References: <20230609151332.263152-1-pctammela@mojatatu.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org X-Patchwork-State: RFC Avoid open coding the rhashtab length read Signed-off-by: Pedro Tammela --- net/ipv6/proc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index e20b3705c2d2..402e4f6f9e25 100644 --- a/net/ipv6/proc.c +++ b/net/ipv6/proc.c @@ -25,6 +25,7 @@ #include #include #include +#include #define MAX4(a, b, c, d) \ max_t(u32, max_t(u32, a, b), max_t(u32, c, d)) @@ -44,7 +45,7 @@ static int sockstat6_seq_show(struct seq_file *seq, void *v) seq_printf(seq, "RAW6: inuse %d\n", sock_prot_inuse_get(net, &rawv6_prot)); seq_printf(seq, "FRAG6: inuse %u memory %lu\n", - atomic_read(&net->ipv6.fqdir->rhashtable.nelems), + rhashtable_len(&net->ipv6.fqdir->rhashtable), frag_mem_limit(net->ipv6.fqdir)); return 0; }