[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <x49eglam8oi.fsf@segfault.boston.devel.redhat.com>
Date: Wed, 17 Jun 2015 15:33:33 -0400
From: Jeff Moyer <jmoyer@...hat.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Al Viro <viro@...IV.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
Benjamin LaHaise <bcrl@...ck.org>, linux-aio@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] aio: make aio_ring->dead boolean
Oleg Nesterov <oleg@...hat.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@...hat.com>" to your v3 posting.
Cheers,
Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists