[PATCH][v2] virtio_fs: Remove redundant spinlock in virtio_fs_request_complete()

lirongqing posted 1 patch 3 months, 3 weeks ago
fs/fuse/virtio_fs.c | 3 ---
1 file changed, 3 deletions(-)
[PATCH][v2] virtio_fs: Remove redundant spinlock in virtio_fs_request_complete()
Posted by lirongqing 3 months, 3 weeks ago
From: Li RongQing <lirongqing@baidu.com>

Since clear_bit is an atomic operation, the spinlock is redundant and
can be removed, reducing lock contention is good for performance.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
Diff with v1: remove unused variable "fpq"

 fs/fuse/virtio_fs.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c
index 53c2626..b8a99d3 100644
--- a/fs/fuse/virtio_fs.c
+++ b/fs/fuse/virtio_fs.c
@@ -762,7 +762,6 @@ static void copy_args_from_argbuf(struct fuse_args *args, struct fuse_req *req)
 static void virtio_fs_request_complete(struct fuse_req *req,
 				       struct virtio_fs_vq *fsvq)
 {
-	struct fuse_pqueue *fpq = &fsvq->fud->pq;
 	struct fuse_args *args;
 	struct fuse_args_pages *ap;
 	unsigned int len, i, thislen;
@@ -791,9 +790,7 @@ static void virtio_fs_request_complete(struct fuse_req *req,
 		}
 	}
 
-	spin_lock(&fpq->lock);
 	clear_bit(FR_SENT, &req->flags);
-	spin_unlock(&fpq->lock);
 
 	fuse_request_end(req);
 	spin_lock(&fsvq->lock);
-- 
2.9.4
Re: [PATCH][v2] virtio_fs: Remove redundant spinlock in virtio_fs_request_complete()
Posted by Miklos Szeredi 3 months, 1 week ago
On Sun, 15 Jun 2025 at 15:22, lirongqing <lirongqing@baidu.com> wrote:
>
> From: Li RongQing <lirongqing@baidu.com>
>
> Since clear_bit is an atomic operation, the spinlock is redundant and
> can be removed, reducing lock contention is good for performance.
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>

Applied, thanks.

Miklos
Re: [PATCH][v2] virtio_fs: Remove redundant spinlock in virtio_fs_request_complete()
Posted by Stefan Hajnoczi 3 months, 3 weeks ago
On Sun, Jun 15, 2025 at 9:21 AM lirongqing <lirongqing@baidu.com> wrote:
>
> From: Li RongQing <lirongqing@baidu.com>
>
> Since clear_bit is an atomic operation, the spinlock is redundant and
> can be removed, reducing lock contention is good for performance.
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> Diff with v1: remove unused variable "fpq"
>
>  fs/fuse/virtio_fs.c | 3 ---
>  1 file changed, 3 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>