Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756593Ab3C2SUJ (ORCPT ); Fri, 29 Mar 2013 14:20:09 -0400 Received: from li9-11.members.linode.com ([67.18.176.11]:57224 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756164Ab3C2SUE (ORCPT ); Fri, 29 Mar 2013 14:20:04 -0400 Date: Fri, 29 Mar 2013 13:14:11 -0400 From: "Theodore Ts'o" To: Kent Overstreet Cc: linux-kernel@vger.kernel.org, linux-aio@kvack.org, akpm@linux-foundation.org, Zach Brown , Felipe Balbi , Greg Kroah-Hartman , Mark Fasheh , Joel Becker , Rusty Russell , Jens Axboe , Asai Thambi S P , Selvan Mani , Sam Bradshaw , Jeff Moyer , Al Viro , Benjamin LaHaise Subject: Re: [PATCH 11/33] aio: make aio_put_req() lockless Message-ID: <20130329171411.GE21902@thunk.org> Mail-Followup-To: Theodore Ts'o , Kent Overstreet , linux-kernel@vger.kernel.org, linux-aio@kvack.org, akpm@linux-foundation.org, Zach Brown , Felipe Balbi , Greg Kroah-Hartman , Mark Fasheh , Joel Becker , Rusty Russell , Jens Axboe , Asai Thambi S P , Selvan Mani , Sam Bradshaw , Jeff Moyer , Al Viro , Benjamin LaHaise References: <1363883754-27966-1-git-send-email-koverstreet@google.com> <1363883754-27966-12-git-send-email-koverstreet@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1363883754-27966-12-git-send-email-koverstreet@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1783 Lines: 37 On Thu, Mar 21, 2013 at 09:35:32AM -0700, Kent Overstreet wrote: > Freeing a kiocb needed to touch the kioctx for three things: > > * Pull it off the reqs_active list > * Decrementing reqs_active > * Issuing a wakeup, if the kioctx was in the process of being freed. > > This patch moves these to aio_complete(), for a couple reasons: > > * aio_complete() already has to issue the wakeup, so if we drop the > kioctx refcount before aio_complete does its wakeup we don't have to > do it twice. > * aio_complete currently has to take the kioctx lock, so it makes sense > for it to pull the kiocb off the reqs_active list too. > * A later patch is going to change reqs_active to include unreaped > completions - this will mean allocating a kiocb doesn't have to look > at the ringbuffer. So taking the decrement of reqs_active out of > kiocb_free() is useful prep work for that patch. > > This doesn't really affect cancellation, since existing (usb) code that > implements a cancel function still calls aio_complete() - we just have > to make sure that aio_complete does the necessary teardown for cancelled > kiocbs. > > It does affect code paths where we free kiocbs that were never > submitted; they need to decrement reqs_active and pull the kiocb off the > reqs_active list. This occurs in two places: kiocb_batch_free(), which > is going away in a later patch, and the error path in io_submit_one. > > Signed-off-by: Kent Overstreet Reviewed-by: "Theodore Ts'o" -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/