diff mbox series

md/raid5-ppl: Use atomic64_inc_return() in ppl_new_iounit()

Message ID 20241007084831.48067-1-ubizjak@gmail.com (mailing list archive)
State Accepted
Headers show
Series md/raid5-ppl: Use atomic64_inc_return() in ppl_new_iounit() | expand

Checks

Context Check Description
mdraidci/vmtest-md-6_12-PR success PR summary
mdraidci/vmtest-md-6_12-VM_Test-0 success Logs for per-patch-testing

Commit Message

Uros Bizjak Oct. 7, 2024, 8:48 a.m. UTC
Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref)
to use optimized implementation and ease register pressure around
the primitive for targets that implement optimized variant.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Song Liu <song@kernel.org>
Cc: Yu Kuai <yukuai3@huawei.com>
---
 drivers/md/raid5-ppl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yu Kuai Oct. 8, 2024, 7:07 a.m. UTC | #1
在 2024/10/07 16:48, Uros Bizjak 写道:
> Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref)
> to use optimized implementation and ease register pressure around
> the primitive for targets that implement optimized variant.
> 
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Song Liu <song@kernel.org>
> Cc: Yu Kuai <yukuai3@huawei.com>

LGTM
Reviewed-by: Yu Kuai <yukuai3@huawei.com>
> ---
>   drivers/md/raid5-ppl.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c
> index a70cbec12ed0..37c4da5311ca 100644
> --- a/drivers/md/raid5-ppl.c
> +++ b/drivers/md/raid5-ppl.c
> @@ -258,7 +258,7 @@ static struct ppl_io_unit *ppl_new_iounit(struct ppl_log *log,
>   	memset(pplhdr->reserved, 0xff, PPL_HDR_RESERVED);
>   	pplhdr->signature = cpu_to_le32(ppl_conf->signature);
>   
> -	io->seq = atomic64_add_return(1, &ppl_conf->seq);
> +	io->seq = atomic64_inc_return(&ppl_conf->seq);
>   	pplhdr->generation = cpu_to_le64(io->seq);
>   
>   	return io;
>
Artur Paszkiewicz Oct. 8, 2024, 7:38 a.m. UTC | #2
On 10/7/24 10:48, Uros Bizjak wrote:
> Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref)
> to use optimized implementation and ease register pressure around
> the primitive for targets that implement optimized variant.
> 
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Song Liu <song@kernel.org>
> Cc: Yu Kuai <yukuai3@huawei.com>

Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Song Liu Oct. 18, 2024, 4 p.m. UTC | #3
On Tue, Oct 8, 2024 at 12:38 AM Artur Paszkiewicz
<artur.paszkiewicz@intel.com> wrote:
>
> On 10/7/24 10:48, Uros Bizjak wrote:
> > Use atomic64_inc_return(&ref) instead of atomic64_add_return(1, &ref)
> > to use optimized implementation and ease register pressure around
> > the primitive for targets that implement optimized variant.
> >
> > Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> > Cc: Song Liu <song@kernel.org>
> > Cc: Yu Kuai <yukuai3@huawei.com>
>
> Reviewed-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>

Applied to md-6.13. Thanks for the patch!

Song
diff mbox series

Patch

diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c
index a70cbec12ed0..37c4da5311ca 100644
--- a/drivers/md/raid5-ppl.c
+++ b/drivers/md/raid5-ppl.c
@@ -258,7 +258,7 @@  static struct ppl_io_unit *ppl_new_iounit(struct ppl_log *log,
 	memset(pplhdr->reserved, 0xff, PPL_HDR_RESERVED);
 	pplhdr->signature = cpu_to_le32(ppl_conf->signature);
 
-	io->seq = atomic64_add_return(1, &ppl_conf->seq);
+	io->seq = atomic64_inc_return(&ppl_conf->seq);
 	pplhdr->generation = cpu_to_le64(io->seq);
 
 	return io;