From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42591C33CB1 for ; Wed, 15 Jan 2020 06:54:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 23DDB24679 for ; Wed, 15 Jan 2020 06:54:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729085AbgAOGyK (ORCPT ); Wed, 15 Jan 2020 01:54:10 -0500 Received: from verein.lst.de ([213.95.11.211]:49217 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726018AbgAOGyK (ORCPT ); Wed, 15 Jan 2020 01:54:10 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 68EA368AFE; Wed, 15 Jan 2020 07:54:06 +0100 (CET) Date: Wed, 15 Jan 2020 07:54:06 +0100 From: Christoph Hellwig To: Matthew Wilcox Cc: Christoph Hellwig , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, Waiman Long , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Will Deacon , Andrew Morton , linux-ext4@vger.kernel.org, cluster-devel@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: RFC: hold i_rwsem until aio completes Message-ID: <20200115065406.GB21219@lst.de> References: <20200114161225.309792-1-hch@lst.de> <20200114184707.GA10467@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200114184707.GA10467@bombadil.infradead.org> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Tue, Jan 14, 2020 at 10:47:07AM -0800, Matthew Wilcox wrote: > It would be helpful if we could also use the same lockdep logic > for PageLocked. Again, it's a case where returning to userspace with > PageLock held is fine, because we're expecting an interrupt to come in > and drop the lock for us. Yes, this is a very typical pattern for I/O. Besides the page and buffer head bit locks it also applies to the semaphore in the xfs_buf structure and probably various other places that currently used hand crafted or legacy locking primitives to escape lockdep. > Perhaps the right answer is, from lockdep's point of view, to mark the > lock as being released at the point where we submit the I/O. Then > in the completion path release the lock without telling lockdep we > released it. That is similar to what the fsfreeze code does, but I don't think it is very optimal, as misses to track any dependencies after I/O submission, and at least some of the completions paths do take locks. But it might be a start.