io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Metzmacher <metze@samba.org>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Subject: Re: [PATCH 3/4] io-wq: allow lookup of existing io_wq with given id
Date: Fri, 24 Jan 2020 10:54:59 +0100	[thread overview]
Message-ID: <c3e67265-dff9-a832-090c-6110dd4ef6c3@samba.org> (raw)
In-Reply-To: <20200123231614.10850-4-axboe@kernel.dk>


[-- Attachment #1.1: Type: text/plain, Size: 803 bytes --]

> +/*
> + * Find and return io_wq with given id and grab a reference to it.
> + */
> +struct io_wq *io_wq_create_id(unsigned bounded, struct io_wq_data *data,
> +			      unsigned int id)
> +{
> +	struct io_wq *wq, *ret = NULL;
> +
> +	mutex_lock(&wq_lock);
> +	list_for_each_entry(wq, &wq_list, wq_list) {
> +		if (id != wq->id)
> +			continue;
> +		if (data->creds != wq->creds || data->user != wq->user)
> +			continue;
> +		if (data->get_work != wq->get_work ||
> +		    data->put_work != wq->put_work)
> +			continue;
> +		if (!refcount_inc_not_zero(&wq->use_refs))
> +			continue;
> +		ret = wq;
> +		break;
> +	}
> +	mutex_unlock(&wq_lock);

Isn't there a more efficient ida_find function in order to avoid
the loop, which won't really scale in the long run.

metze


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-01-24  9:55 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23 23:16 [PATCHSET 0/4] Add support for shared io-wq backends Jens Axboe
2020-01-23 23:16 ` [PATCH 1/4] io-wq: make the io_wq ref counted Jens Axboe
2020-01-23 23:16 ` [PATCH 2/4] io-wq: add 'id' to io_wq Jens Axboe
2020-01-23 23:16 ` [PATCH 3/4] io-wq: allow lookup of existing io_wq with given id Jens Axboe
2020-01-24  9:54   ` Stefan Metzmacher [this message]
2020-01-24 16:41     ` Jens Axboe
2020-01-23 23:16 ` [PATCH 4/4] io_uring: add support for sharing kernel io-wq workqueue Jens Axboe
2020-01-24  9:51 ` [PATCHSET 0/4] Add support for shared io-wq backends Stefan Metzmacher
2020-01-24 16:43   ` Jens Axboe
2020-01-24 19:14     ` Stefan Metzmacher
2020-01-24 21:37       ` Jens Axboe
2020-01-24 20:34 ` Pavel Begunkov
2020-01-24 21:38   ` Jens Axboe
2020-01-26  1:51 ` Daurnimator
2020-01-26 15:11   ` Pavel Begunkov
2020-01-26 17:00     ` Jens Axboe
2020-01-27 13:29       ` Pavel Begunkov
2020-01-27 13:39         ` Jens Axboe
2020-01-27 14:07           ` Pavel Begunkov
2020-01-27 19:39             ` Pavel Begunkov
2020-01-27 19:45               ` Jens Axboe
2020-01-27 20:33             ` Jens Axboe
2020-01-27 21:45               ` Pavel Begunkov
2020-01-27 22:40                 ` Jens Axboe
2020-01-27 23:00                   ` Jens Axboe
2020-01-27 23:17                     ` Pavel Begunkov
2020-01-27 23:23                       ` Jens Axboe
2020-01-27 23:25                         ` Pavel Begunkov
2020-01-27 23:38                           ` Jens Axboe
2020-01-28 10:01                             ` Stefan Metzmacher
2020-01-28 10:30                               ` Pavel Begunkov
2020-01-28 10:35                                 ` Stefan Metzmacher
2020-01-28 10:51                                   ` Pavel Begunkov
2020-01-24 21:31 [PATCHSET v2 " Jens Axboe
2020-01-24 21:31 ` [PATCH 3/4] io-wq: allow lookup of existing io_wq with given id 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=c3e67265-dff9-a832-090c-6110dd4ef6c3@samba.org \
    --to=metze@samba.org \
    --cc=axboe@kernel.dk \
    --cc=io-uring@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).