On 1/24/20 2:54 AM, Stefan Metzmacher wrote: >> +/* >> + * 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. Yeah that would be a lot better - I initially just used a sequence for this, but since I'm now using ida, might as well use it for lookup as well. I'll make the change. -- Jens Axboe