All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: Paolo Valente <paolo.valente@linaro.org>, Jan Kara <jack@suse.cz>,
	linux-block@vger.kernel.org
Subject: [PATCH 02/11] block: simplify struct io_context refcounting
Date: Thu,  9 Dec 2021 07:31:22 +0100	[thread overview]
Message-ID: <20211209063131.18537-3-hch@lst.de> (raw)
In-Reply-To: <20211209063131.18537-1-hch@lst.de>

Don't hold a reference to ->refcount for each active reference, but
just one for all active references.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
---
 block/blk-ioc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/block/blk-ioc.c b/block/blk-ioc.c
index 96336c2134efa..9cde3906be3c6 100644
--- a/block/blk-ioc.c
+++ b/block/blk-ioc.c
@@ -180,10 +180,8 @@ static void put_io_context_active(struct io_context *ioc)
 {
 	struct io_cq *icq;
 
-	if (!atomic_dec_and_test(&ioc->active_ref)) {
-		put_io_context(ioc);
+	if (!atomic_dec_and_test(&ioc->active_ref))
 		return;
-	}
 
 	spin_lock_irq(&ioc->lock);
 	hlist_for_each_entry(icq, &ioc->icq_list, ioc_node) {
@@ -335,7 +333,6 @@ int __copy_io(unsigned long clone_flags, struct task_struct *tsk)
 	 * Share io context with parent, if CLONE_IO is set
 	 */
 	if (clone_flags & CLONE_IO) {
-		atomic_long_inc(&ioc->refcount);
 		atomic_inc(&ioc->active_ref);
 		tsk->io_context = ioc;
 	} else if (ioprio_valid(ioc->ioprio)) {
-- 
2.30.2


  parent reply	other threads:[~2021-12-09  6:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-09  6:31 more I/O context cleanup v2 Christoph Hellwig
2021-12-09  6:31 ` [PATCH 01/11] block: remove the nr_task field from struct io_context Christoph Hellwig
2021-12-09  6:31 ` Christoph Hellwig [this message]
2021-12-09  6:31 ` [PATCH 03/11] block: refactor put_iocontext_active Christoph Hellwig
2021-12-09  6:31 ` [PATCH 04/11] block: remove the NULL ioc check in put_io_context Christoph Hellwig
2021-12-09  6:31 ` [PATCH 05/11] block: refactor put_io_context Christoph Hellwig
2021-12-09  6:31 ` [PATCH 06/11] block: cleanup ioc_clear_queue Christoph Hellwig
2021-12-14 15:50   ` Jan Kara
2021-12-09  6:31 ` [PATCH 07/11] block: move set_task_ioprio to blk-ioc.c Christoph Hellwig
2021-12-14 15:52   ` Jan Kara
2021-12-09  6:31 ` [PATCH 08/11] block: fold get_task_io_context into set_task_ioprio Christoph Hellwig
2021-12-14 15:52   ` Jan Kara
2021-12-09  6:31 ` [PATCH 09/11] block: open code create_task_io_context in set_task_ioprio Christoph Hellwig
2021-12-14 15:56   ` Jan Kara
2021-12-09  6:31 ` [PATCH 10/11] block: fold create_task_io_context into ioc_find_get_icq Christoph Hellwig
2021-12-14 16:01   ` Jan Kara
2021-12-09  6:31 ` [PATCH 11/11] block: only build the icq tracking code when needed Christoph Hellwig
2021-12-16 18:02 ` more I/O context cleanup v2 Jens Axboe

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=20211209063131.18537-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=axboe@kernel.dk \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=paolo.valente@linaro.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 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.