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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6878AC5478C for ; Wed, 28 Feb 2024 17:34:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F07116B00A3; Wed, 28 Feb 2024 12:34:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EB7E66B00A4; Wed, 28 Feb 2024 12:34:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D7FF36B00A5; Wed, 28 Feb 2024 12:34:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id CA79A6B00A3 for ; Wed, 28 Feb 2024 12:34:51 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 8E2A71409A5 for ; Wed, 28 Feb 2024 17:34:51 +0000 (UTC) X-FDA: 81841912782.01.9E20D99 Received: from out-186.mta1.migadu.com (out-186.mta1.migadu.com [95.215.58.186]) by imf07.hostedemail.com (Postfix) with ESMTP id 993794000F for ; Wed, 28 Feb 2024 17:34:48 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Xsv9APsW; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf07.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.186 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709141689; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+VifRWwyg3xehvBuDElHHRvJUjq5o45Rw/PLy+arOnY=; b=RKCC/UveUhP1Ow35h+fuzDvYdh83Eb3pQP8KQwvSSA3vZ0Rx2DKyVCCdFY6/MdbWzM/fo9 2MOz8s5JNEEIOo/tppvnTHIttaw8jzSMB6NsCBWPna5lCpe+yITPUWfMeWP8CL5s8VvjU8 JstBZBcrVHkEdPiRC9UGRPWYsF2YQgE= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=Xsv9APsW; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf07.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.186 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709141689; a=rsa-sha256; cv=none; b=coGuzO1cE5B4qLjUny7UtnMAghLf8/vnOq6RgtRGHwwFjcc5Pe17BXjLQknfMkmZoF+pfe Q76ed9lZMii5AxFEupLzHHvS8oOyBP4nWxT5bvHhmi+WMQrTQ/1nuUSN/RWD7PzNWcukpR VeSssv5/kh4+y+8wnXBphWUmC12lu3o= Date: Wed, 28 Feb 2024 12:34:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709141686; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=+VifRWwyg3xehvBuDElHHRvJUjq5o45Rw/PLy+arOnY=; b=Xsv9APsWCSfWJDO4O5xvhuSfrLNc9l9CaZfiaDYepMthbWLm5DHwI/BbnTz7ZBAasJ94Ic 1dYvQAUL5fkU+2++Q1kRckkSiL/hpZQKuHdOpFegNlZ6vAvX1KNlx8Hvw7z9aCE2+0aXg3 gidQV3MIchIu/ac2GjY4LXOD1/rqdqQ= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Matthew Wilcox 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: <72fsezoex3soqbjsuabjzyzhlbeouy2uu75h5hcia3stwfv7q4@batxjbhkcnnc> References: <4rde5abojkj6neokif4j6z4bgkqwztowfiiklpvxramiuhvzjb@ts5af6w4bl4t> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 993794000F X-Stat-Signature: 6d4n6w5cyrgcgpkdcpaq7duxh5tzf9nz X-HE-Tag: 1709141688-717434 X-HE-Meta: U2FsdGVkX19ued+V2kxLf6h4fDbnEDuVcXB0y9/r/FjOg3ukEL5euEwe9KhgXutvGMK8xPIqHTWtzoPlBl7oEZGJblJ5jwpjVXnVP2+uA/hyRERbrX5gfddkSTUTSd7zam065CXbtJ9PQQhexNZizQvaiPL0CnsW78gp7yLjQS6cFWuubpA6W08OFb4PKLPeNHbESShnjpK5CyLqRK9a3E9GCQfmWrI/LMEs/g7zy/Hh7/X328rbFHmo8jWhkJ7zTe0xhvDhTLKBmoIE+X3CX4psXtDqJh8OUr0ccGnXv+p+ogFtRcexUTDUfcX3YxvckkYuDULkUvcJmF0cQxovnHAy8uvLLvgmZ1oAd+NbGQEgtCSYseDr52zR1Xv90PNPynjAVZMEKWHeGM5QEPAFaxbR06p9+zHPWy+CKXCccZxcLe5oC8LWrQDZzFTNgYpAqJeWnZEEIjn9h6r9fzO0vARoP1DPZsD1U373zpcHX5+/h7GrWRX7zWPURuieCDJpwTI7j2/5Ujc3MU5ec2eze3VNf110u6v5EQa2RSkIY1ql9cPYdtM+d8EL/1gsbWUjYBaOHMP2Mte30NA7Z1WdQ7RHx541mbiEohoYUGXSceO+XU/MRYawOQC3B6lR9DOEyPWKINYQ7yv6o3raoT2FUePgyWFfUy3sryUxJgFj0sH4EVTAMMQjVacdk8uNjbkwwfs2l3ECNjWHAqNJTXNraWQdeiyuIaGCt5EiBIDcs1Cmc4WogRFWQirkgIeCqYg9n4wfgigwbRhebVYjwEt790X1xji4urm6UzV5qGrTimI3EoqhqvNRlfvs1G/N8OZ0F6yOTS/HC6RQw7CV/zQ7lJJT//LJFfyyy3cAYjPYqDFWy6wLNKUKW5qNQx432C44nsgRlhDmWYO2nbzEjOBCkVpn4Uqdtx0WmtuX0CwX4KEIXiy7KCswi4TM93zq7JvFF02hW4c6e1MYNtfuFKD RGvQoH+l OSWmF+H5aT1oMPaWKEEWztX8q0/VtkR2Fc+bC7/g2E9OzFSgt87pIs2Pm47Bhzu7zU3ZjJ3GgvR/ofzb8t/oe7YUuyQ== 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: List-Subscribe: List-Unsubscribe: On Wed, Feb 28, 2024 at 04:22:32AM +0000, Matthew Wilcox wrote: > 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()? I should have seen that :) But even better would be if we could get lockdep to support folio locks, then we could define a lockdep comparison function. Of course, there's no place to stick a lockdep map, but I think technically lockdep could do everything it needs to do without state in the lock itself, if only that code didn't make my eyes bleed whenever I have to dig into it...