From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB07820DC9 for ; Wed, 28 Feb 2024 04:22:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709094164; cv=none; b=BrsBsXuBYk1cQv1kuEPDisGW7Gf9rfvpDKsfj/n86Mlul5j5j6faFM5bMIAizVzaDSeVMrtkaKjxOJY4XvnFIB6y/MB8J31KW1Y47dWtx28TTLeTVAML8nlSuK6lVQkCZfnbBBDm41fluuaMd8IoA5derktFsJXZqD6hfJ8sJ58= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709094164; c=relaxed/simple; bh=N1wbeDl5iQVq60uoGeHadbMS92tsdw2+xsEeFfMclRQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nUszijKxP9WYrJWi80LMkwcwmcGs9T+8TtS13k4aMpcFqG0oICxMssPwvYor/pWddEq/zCGv2baNHt/HABQsrQFkrvJkuUcBLbJbF1wMwqt2Z5UtYNwlzNx1J0Zvw04s6LXDkMJpB26+x/hyBjG9v8LZvmiOXZpraNIJ6qka35A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=bnMVz8HP; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="bnMVz8HP" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hmC0rMc+RpbdHnLbpCJcomObutjlQbb7NzvcfcXhktk=; b=bnMVz8HPzO7kypVgoCf3rpcAMF mMMJhLFJ+skv9Tl7aFh44Vfiy0fJUWz5HOQcwwuZdIUWdPtQu5oh52P6nhF8lNhRplJMm260v6cNq jAZQrUHWmhiwTZ/I+Fnf+KQq8ISvV6uSu43lscJKHfjax2/+XJvYG4q7M2eBC0ztXu555NA9MV2bm xWLKQ8gcvi4cwDCLnXHKyFqTHTmoQmIsC7r421JAGZ09p7gefmBLMdpKOTCPedI7oRJjDxaW7o/E3 KzrHQA/mO6gjO8eXwr5cjA2DJJFkOBnk1Pm9QTc2KjXFKZvxupJauVLzuNY/aSMNUCiCzcgq3ksdP IFUl8S/Q==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfBSi-00000004EmB-20fq; Wed, 28 Feb 2024 04:22:32 +0000 Date: Wed, 28 Feb 2024 04:22:32 +0000 From: Matthew Wilcox To: Kent Overstreet Cc: Linus Torvalds , Dave Chinner , Luis Chamberlain , lsf-pc@lists.linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-mm , Daniel Gomez , Pankaj Raghav , Jens Axboe , Christoph Hellwig , Chris Mason , Johannes Weiner Subject: Re: [LSF/MM/BPF TOPIC] Measuring limits and enhancing buffered IO Message-ID: References: <4rde5abojkj6neokif4j6z4bgkqwztowfiiklpvxramiuhvzjb@ts5af6w4bl4t> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Feb 28, 2024 at 03:00:36AM +0000, Matthew Wilcox wrote: > On Tue, Feb 27, 2024 at 09:22:26PM -0500, Kent Overstreet wrote: > > Which does raise the question of if we've ever attempted to define a > > lock ordering on folios. I suspect not, since folio lock doesn't even > > seem to have lockdep support. > > We even wrote it down! > > /* > * To avoid deadlocks between range_cyclic writeback and callers > * that hold pages in PageWriteback to aggregate I/O until > * the writeback iteration finishes, we do not loop back to the > * start of the file. Doing so causes a page lock/page > * writeback access order inversion - we should only ever lock > * multiple pages in ascending page->index order, and looping > * back to the start of the file violates that rule and causes > * deadlocks. > */ > > (I'll take the AR to put this somewhere better like in the folio_lock() > kernel-doc) Um. I already did. * Context: May sleep. If you need to acquire the locks of two or * more folios, they must be in order of ascending index, if they are * in the same address_space. If they are in different address_spaces, * acquire the lock of the folio which belongs to the address_space which * has the lowest address in memory first. Where should I have put this information that you would have found it, if not in the kernel-doc for folio_lock()?