lkml.org 
[lkml]   [2018]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] aio: Convert ioctx_table to XArray
From
Date
On 12/11/18 11:46 AM, Jens Axboe wrote:
> On 12/11/18 11:45 AM, Matthew Wilcox wrote:
>> On Tue, Dec 11, 2018 at 11:41:55AM -0700, Jens Axboe wrote:
>>> On Wed, Nov 28, 2018 at 11:35 AM Matthew Wilcox <willy@infradead.org> wrote:
>>>>
>>>> rcu_read_lock();
>>>> - table = rcu_dereference(mm->ioctx_table);
>>>> -
>>>> - if (!table || id >= table->nr)
>>>> - goto out;
>>>> -
>>>> - ctx = rcu_dereference(table->table[id]);
>>>> + ctx = xa_load(&mm->ioctx, id);
>>>> if (ctx && ctx->user_id == ctx_id) {
>>>> if (percpu_ref_tryget_live(&ctx->users))
>>>> ret = ctx;
>>>> }
>>>
>>> Question on this part - do we need that RCU read lock around this now? I
>>> don't think we do.
>>
>> I think we need the rcu read lock here to prevent ctx from being freed
>> under us by free_ioctx().
>
> Then that begs the question, how about __xa_load() that is already called
> under RCU read lock?

Something like this, mem remap has an existing user that can use this
too already.

--
Jens Axboe

\
 
 \ /
  Last update: 2018-12-11 19:54    [W:0.046 / U:23.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site