From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755726AbbFQTdl (ORCPT ); Wed, 17 Jun 2015 15:33:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54296 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754693AbbFQTdf (ORCPT ); Wed, 17 Jun 2015 15:33:35 -0400 From: Jeff Moyer To: Oleg Nesterov Cc: Al Viro , Andrew Morton , Benjamin LaHaise , linux-aio@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] aio: make aio_ring->dead boolean References: <20150616230414.GA15776@redhat.com> <20150616230429.GA15793@redhat.com> <20150616235006.GA18598@redhat.com> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 X-PCLoadLetter: What the f**k does that mean? Date: Wed, 17 Jun 2015 15:33:33 -0400 In-Reply-To: <20150616235006.GA18598@redhat.com> (Oleg Nesterov's message of "Wed, 17 Jun 2015 01:50:06 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oleg Nesterov 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 " to your v3 posting. Cheers, Jeff