mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs: quota: use group allocation of per-cpu counters API
@ 2024-03-25  4:12 Kefeng Wang
  2024-03-25 19:09 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Kefeng Wang @ 2024-03-25  4:12 UTC (permalink / raw)
  To: Jan Kara, Dennis Zhou; +Cc: linux-kernel, Kefeng Wang

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fs: quota: use group allocation of per-cpu counters API
  2024-03-25  4:12 [PATCH] fs: quota: use group allocation of per-cpu counters API Kefeng Wang
@ 2024-03-25 19:09 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2024-03-25 19:09 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: Jan Kara, Dennis Zhou, linux-kernel

On Mon 25-03-24 12:12:40, Kefeng Wang wrote:
> Use group allocation of per-cpu counters api to accelerate
> dquot_init() and simplify code.
> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

Looks good. I've merged the patch to my tree. Thanks!

								Honza

> ---
>  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
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-25 19:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-25  4:12 [PATCH] fs: quota: use group allocation of per-cpu counters API Kefeng Wang
2024-03-25 19:09 ` Jan Kara

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®