Messages in this thread | | | From | Jeff Moyer <> | Subject | Re: [PATCH v2 2/3] aio: make aio_ring->dead boolean | Date | Wed, 17 Jun 2015 15:33:33 -0400 |
| |
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
| |