All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Henriques <luis@igalia.com>
To: Bernd Schubert <bschubert@ddn.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	 Joanne Koong <joannelkoong@gmail.com>,
	 linux-fsdevel@vger.kernel.org,  Gang He <dchg2000@gmail.com>
Subject: Re: [PATCH v3 1/6] fuse: {io-uring} Add queue length counters
Date: Wed, 15 Oct 2025 10:19:50 +0100	[thread overview]
Message-ID: <87sefk8qtl.fsf@igalia.com> (raw)
In-Reply-To: <20251013-reduced-nr-ring-queues_3-v3-1-6d87c8aa31ae@ddn.com> (Bernd Schubert's message of "Mon, 13 Oct 2025 19:09:57 +0200")

On Mon, Oct 13 2025, Bernd Schubert wrote:

> This is another preparation and will be used for decision
> which queue to add a request to.

Just a very small nit: "This is another preparation..." -- this is the
first patch in the series, so it makes more sense to have this sentence in
the second patch instead.  I guess the patches got reordered at some point
and the wording didn't got updated accordingly.

Cheers,
-- 
Luís

>
> Signed-off-by: Bernd Schubert <bschubert@ddn.com>
> Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
> ---
>  fs/fuse/dev_uring.c   | 17 +++++++++++++++--
>  fs/fuse/dev_uring_i.h |  3 +++
>  2 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
> index f6b12aebb8bbe7d255980593b75b5fb5af9c669e..872ae17ffaf49a30c46ef89c1668684a61a0cce4 100644
> --- a/fs/fuse/dev_uring.c
> +++ b/fs/fuse/dev_uring.c
> @@ -86,13 +86,13 @@ static void fuse_uring_req_end(struct fuse_ring_ent *ent, struct fuse_req *req,
>  	lockdep_assert_not_held(&queue->lock);
>  	spin_lock(&queue->lock);
>  	ent->fuse_req = NULL;
> +	queue->nr_reqs--;
>  	if (test_bit(FR_BACKGROUND, &req->flags)) {
>  		queue->active_background--;
>  		spin_lock(&fc->bg_lock);
>  		fuse_uring_flush_bg(queue);
>  		spin_unlock(&fc->bg_lock);
>  	}
> -
>  	spin_unlock(&queue->lock);
>  
>  	if (error)
> @@ -112,6 +112,7 @@ static void fuse_uring_abort_end_queue_requests(struct fuse_ring_queue *queue)
>  	list_for_each_entry(req, &queue->fuse_req_queue, list)
>  		clear_bit(FR_PENDING, &req->flags);
>  	list_splice_init(&queue->fuse_req_queue, &req_list);
> +	queue->nr_reqs = 0;
>  	spin_unlock(&queue->lock);
>  
>  	/* must not hold queue lock to avoid order issues with fi->lock */
> @@ -1280,10 +1281,13 @@ void fuse_uring_queue_fuse_req(struct fuse_iqueue *fiq, struct fuse_req *req)
>  	req->ring_queue = queue;
>  	ent = list_first_entry_or_null(&queue->ent_avail_queue,
>  				       struct fuse_ring_ent, list);
> +	queue->nr_reqs++;
> +
>  	if (ent)
>  		fuse_uring_add_req_to_ring_ent(ent, req);
>  	else
>  		list_add_tail(&req->list, &queue->fuse_req_queue);
> +
>  	spin_unlock(&queue->lock);
>  
>  	if (ent)
> @@ -1319,6 +1323,7 @@ bool fuse_uring_queue_bq_req(struct fuse_req *req)
>  	set_bit(FR_URING, &req->flags);
>  	req->ring_queue = queue;
>  	list_add_tail(&req->list, &queue->fuse_req_bg_queue);
> +	queue->nr_reqs++;
>  
>  	ent = list_first_entry_or_null(&queue->ent_avail_queue,
>  				       struct fuse_ring_ent, list);
> @@ -1351,8 +1356,16 @@ bool fuse_uring_queue_bq_req(struct fuse_req *req)
>  bool fuse_uring_remove_pending_req(struct fuse_req *req)
>  {
>  	struct fuse_ring_queue *queue = req->ring_queue;
> +	bool removed = fuse_remove_pending_req(req, &queue->lock);
>  
> -	return fuse_remove_pending_req(req, &queue->lock);
> +	if (removed) {
> +		/* Update counters after successful removal */
> +		spin_lock(&queue->lock);
> +		queue->nr_reqs--;
> +		spin_unlock(&queue->lock);
> +	}
> +
> +	return removed;
>  }
>  
>  static const struct fuse_iqueue_ops fuse_io_uring_ops = {
> diff --git a/fs/fuse/dev_uring_i.h b/fs/fuse/dev_uring_i.h
> index 51a563922ce14158904a86c248c77767be4fe5ae..c63bed9f863d53d4ac2bed7bfbda61941cd99083 100644
> --- a/fs/fuse/dev_uring_i.h
> +++ b/fs/fuse/dev_uring_i.h
> @@ -94,6 +94,9 @@ struct fuse_ring_queue {
>  	/* background fuse requests */
>  	struct list_head fuse_req_bg_queue;
>  
> +	/* number of requests queued or in userspace */
> +	unsigned int nr_reqs;
> +
>  	struct fuse_pqueue fpq;
>  
>  	unsigned int active_background;
>
> -- 
> 2.43.0
>


  reply	other threads:[~2025-10-15  9:19 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 17:09 [PATCH v3 0/6] fuse: {io-uring} Allow to reduce the number of queues and request distribution Bernd Schubert
2025-10-13 17:09 ` [PATCH v3 1/6] fuse: {io-uring} Add queue length counters Bernd Schubert
2025-10-15  9:19   ` Luis Henriques [this message]
2025-10-13 17:09 ` [PATCH v3 2/6] fuse: {io-uring} Rename ring->nr_queues to max_nr_queues Bernd Schubert
2025-10-13 17:09 ` [PATCH v3 3/6] fuse: {io-uring} Use bitmaps to track registered queues Bernd Schubert
2025-10-15 23:49   ` Joanne Koong
2025-10-16 11:33     ` Bernd Schubert
2025-10-13 17:10 ` [PATCH v3 4/6] fuse: {io-uring} Distribute load among queues Bernd Schubert
2025-10-18  0:12   ` Joanne Koong
2025-10-20 19:00     ` Bernd Schubert
2025-10-20 22:59       ` Joanne Koong
2025-10-20 23:28         ` Bernd Schubert
2025-10-24 17:05         ` Joanne Koong
2025-10-24 17:52           ` Bernd Schubert
2025-10-24 17:58             ` Bernd Schubert
2025-10-13 17:10 ` [PATCH v3 5/6] fuse: {io-uring} Allow reduced number of ring queues Bernd Schubert
2025-10-15  9:25   ` Luis Henriques
2025-10-15  9:31     ` Bernd Schubert
2025-10-13 17:10 ` [PATCH v3 6/6] fuse: {io-uring} Queue background requests on a different core Bernd Schubert
2025-10-15  9:50   ` Luis Henriques
2025-10-15 10:27     ` Bernd Schubert
2025-10-15 11:05       ` Luis Henriques
2025-10-14  8:43 ` [PATCH v3 0/6] fuse: {io-uring} Allow to reduce the number of queues and request distribution Gang He
2025-10-14  9:14   ` Bernd Schubert
2025-10-16  6:15     ` Gang He
  -- strict thread matches above, loose matches on Subject: below --
2025-10-20  7:09 [PATCH v3 6/6] fuse: {io-uring} Queue background requests on a different core kernel test robot
2025-10-20  7:15 ` Dan Carpenter

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=87sefk8qtl.fsf@igalia.com \
    --to=luis@igalia.com \
    --cc=bschubert@ddn.com \
    --cc=dchg2000@gmail.com \
    --cc=joannelkoong@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.