[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-aio
Subject: Re: [PATCH v2 2/3] aio: make aio_ring->dead boolean
From: Jeff Moyer <jmoyer () redhat ! com>
Date: 2015-06-17 19:33:33
Message-ID: x49eglam8oi.fsf () segfault ! boston ! devel ! redhat ! com
[Download RAW message or body]
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
--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org. For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic