lkml.org 
[lkml]   [2015]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 2/3] aio: make aio_ring->dead boolean
Date
Oleg Nesterov <oleg@redhat.com> writes:

> On 06/17, Oleg Nesterov wrote:
>>
>> @@ -327,7 +327,7 @@ static int aio_ring_remap(struct file *file, struct vm_area_struct *vma)
>> for (i = 0; i < table->nr; i++) {
>> struct kioctx *ctx = table->table[i];
>>
>> - if (!ctx || WARN_ON(atomic_read(&ctx->dead)))
>> + if (!ctx || ctx->dead)
>
> Argh, sorry, I removed WARN_ON() by accident.
>
> ------------------------------------------------------------------------------
> Subject: [PATCH v2 2/3] aio: make aio_ring->dead boolean
>
> "atomic_t dead" makes no sense. atomic_read() is the plain LOAD,
> it doesn't have some "additional" synchronization with xchg().
>
> And now that kill_ioctx() sets "dead" under mm->ioctx_lock we do
> not even need xchg().

I think this makes sense and is safe. The key for the reader is that it
will see the updated ctx->dead after it's been woken up.

> @@ -768,7 +768,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
> err_cleanup:
> aio_nr_sub(ctx->max_reqs);
> err_ctx:
> - atomic_set(&ctx->dead, 1);
> + ctx->dead = true; /* unneeded */

And I agree that this can be nuked. You can add my "Reviewed-by: Jeff
Moyer <jmoyer@redhat.com>" to your v3 posting.

Cheers,
Jeff


\
 
 \ /
  Last update: 2015-06-17 21:41    [W:0.035 / U:0.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site