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 0D9CCC33CB1 for ; Wed, 15 Jan 2020 06:54:11 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CE8B124679 for ; Wed, 15 Jan 2020 06:54:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CE8B124679 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 55FFD8E0005; Wed, 15 Jan 2020 01:54:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 50F6D8E0003; Wed, 15 Jan 2020 01:54:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4252C8E0005; Wed, 15 Jan 2020 01:54:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0247.hostedemail.com [216.40.44.247]) by kanga.kvack.org (Postfix) with ESMTP id 288168E0003 for ; Wed, 15 Jan 2020 01:54:10 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id D51ED180AD82F for ; Wed, 15 Jan 2020 06:54:09 +0000 (UTC) X-FDA: 76378954218.14.face66_2448cb430b32e X-HE-Tag: face66_2448cb430b32e X-Filterd-Recvd-Size: 2266 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Wed, 15 Jan 2020 06:54:09 +0000 (UTC) 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.