Oleg Nesterov <[email protected]> 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 <[email protected]>" to your v3 posting.

Cheers,
Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to