From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Jan Kara <jack@suse.com>, Dennis Zhou <dennis@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: [PATCH] fs: quota: use group allocation of per-cpu counters API
Date: Mon, 25 Mar 2024 12:12:40 +0800 [thread overview]
Message-ID: <20240325041240.53537-1-wangkefeng.wang@huawei.com> (raw)
Use group allocation of per-cpu counters api to accelerate
dquot_init() and simplify code.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
fs/quota/dquot.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index dacbee455c03..808544f74e5e 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -3016,11 +3016,10 @@ static int __init dquot_init(void)
if (!dquot_hash)
panic("Cannot create dquot hash table");
- for (i = 0; i < _DQST_DQSTAT_LAST; i++) {
- ret = percpu_counter_init(&dqstats.counter[i], 0, GFP_KERNEL);
- if (ret)
- panic("Cannot create dquot stat counters");
- }
+ ret = percpu_counter_init_many(dqstats.counter, 0, GFP_KERNEL,
+ _DQST_DQSTAT_LAST);
+ if (ret)
+ panic("Cannot create dquot stat counters");
/* Find power-of-two hlist_heads which can fit into allocation */
nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head);
--
2.41.0
next reply other threads:[~2024-03-25 3:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-25 4:12 Kefeng Wang [this message]
2024-03-25 19:09 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240325041240.53537-1-wangkefeng.wang@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=dennis@kernel.org \
--cc=jack@suse.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®