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 10E71D32D7C for ; Tue, 12 Nov 2024 09:50:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94A526B00DC; Tue, 12 Nov 2024 04:50:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F6DD6B00E1; Tue, 12 Nov 2024 04:50:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 770468D0001; Tue, 12 Nov 2024 04:50:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 52EC06B00DC for ; Tue, 12 Nov 2024 04:50:58 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id CC360121957 for ; Tue, 12 Nov 2024 09:50:57 +0000 (UTC) X-FDA: 82776972936.24.EC3DBB8 Received: from fout-b3-smtp.messagingengine.com (fout-b3-smtp.messagingengine.com [202.12.124.146]) by imf11.hostedemail.com (Postfix) with ESMTP id 5BC874000D for ; Tue, 12 Nov 2024 09:50:04 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=shutemov.name header.s=fm2 header.b="s qEcSnp"; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=CiwMk+jp; dmarc=none; spf=pass (imf11.hostedemail.com: domain of kirill@shutemov.name designates 202.12.124.146 as permitted sender) smtp.mailfrom=kirill@shutemov.name ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731404927; a=rsa-sha256; cv=none; b=M8aP9T4sZO2unnxETP7l3X4v9yuUqEjIbOizQ2YMLYB7X+S8fH2IyOi5uRUMfK6JvlE4uP ESclo+iHm/y6K0Pl5ZfFs7v6eYKGfeLOOyrZpq56L4pqMViqMM6JBCk7cQ0XRUdTzEPHiV o3YaNkylRfE6Oc53vl2VUmUd5nYag6g= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=shutemov.name header.s=fm2 header.b="s qEcSnp"; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=CiwMk+jp; dmarc=none; spf=pass (imf11.hostedemail.com: domain of kirill@shutemov.name designates 202.12.124.146 as permitted sender) smtp.mailfrom=kirill@shutemov.name ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731404927; 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=q6d4TW3b9u4ERBhUXTON+1lh+lOfBpLQCjeY8XLQHRQ=; b=zLeSCKBejw+3Avdu8czEKxLUPeq8mzXJtK7kr9EC+6uuNI3gZz3fmQJmLtuC56X4eOMMrr jUjQHcXPsWfLEUemJZoCxfuIBRFQktUvEeeSYh7p0lfs16fogrgRrfCky+R+krnw6n0EPd 8vRTOBnDaWyOKk8FqhLCJCjadoO408A= Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.stl.internal (Postfix) with ESMTP id ACB661140214; Tue, 12 Nov 2024 04:50:54 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Tue, 12 Nov 2024 04:50:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov.name; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1731405054; x= 1731491454; bh=q6d4TW3b9u4ERBhUXTON+1lh+lOfBpLQCjeY8XLQHRQ=; b=s qEcSnpAxRWFu4D3RBfoLcFrMbOZ4tGmkoSwQt4g4syulATNYNEk7t0Tb1XoEfvFJ zKA5VrPe2L1E+bexnENdIvdk8EZpzmdJDH2l/nP5Bv7K6Z33wyVz0YpAfj6bflIj c6q38S/Zaj1MKis4qdYsPbBAHWlhpUP709ccxsCAK6FVCuvr4MyWqbfG8q6d9DLw lv+H81SQeWxCkcfxGYZ0fJinUIVETGm6It5A7QFx80TTATJLar9lVqq5vxls8Xy9 SH8MNzVYa8zu16u+BGSugl5vox/ADaAqMPwkWhQbygVUA6ml6M1VkOFA2TIsdNA4 5o97a/7IElN7nCIbJC0gQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1731405054; x=1731491454; bh=q6d4TW3b9u4ERBhUXTON+1lh+lOfBpLQCje Y8XLQHRQ=; b=CiwMk+jp+BR7V3cpmHYvsqhm1AJB1ek8zLh7j5vrUb3SCXyrbDh GonYvh+OvM2Oa1t+ZFv2rojrA32W6dnOMc2BDnlVtmCY/1W9936QNi+G/Xoz0gYh FMlJdVoJG2eBR7P3FXVhsH+3v7n5epXgGEb1g5aSBCUFsfoKtEdXGWAAHQSbjJ0k J1HTy8PjMDpDl6KrZI/VLXTnqM8T7Q2b6578Pux6zjUh0XZ/b1UNsG0wiFgwyCWH FuJj6/IMEwp7lXn0tjYfA33glxoBwG3No/n5KTzowKod5vUXwB/q3VpYb5AhYdmz AQq/0pGrsrooR50VORt5UogfPdQfjnL5r9A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrudeggddthecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpeffhffvvefukfhfgggtuggjsehttdfstddttddvnecu hfhrohhmpedfmfhirhhilhhlucetrdcuufhhuhhtvghmohhvfdcuoehkihhrihhllhessh hhuhhtvghmohhvrdhnrghmvgeqnecuggftrfgrthhtvghrnhepffdvveeuteduhffhffev lefhteefveevkeelveejudduvedvuddvleetudevhfeknecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepkhhirhhilhhlsehshhhuthgvmhhovhdr nhgrmhgvpdhnsggprhgtphhtthhopeduuddpmhhouggvpehsmhhtphhouhhtpdhrtghpth htohepuggrvhhiugesfhhrohhmohhrsghithdrtghomhdprhgtphhtthhopegrgigsohgv sehkvghrnhgvlhdrughkpdhrtghpthhtoheplhhinhhugidqmhhmsehkvhgrtghkrdhorh hgpdhrtghpthhtoheplhhinhhugidqfhhsuggvvhgvlhesvhhgvghrrdhkvghrnhgvlhdr ohhrghdprhgtphhtthhopehhrghnnhgvshestghmphigtghhghdrohhrghdprhgtphhtth hopegtlhhmsehmvghtrgdrtghomhdprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhes vhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopeifihhllhihsehinhhfrhgrug gvrggurdhorhhgpdhrtghpthhtoheplhhinhhugidqsghtrhhfshesvhhgvghrrdhkvghr nhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie3994620:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 12 Nov 2024 04:50:50 -0500 (EST) Date: Tue, 12 Nov 2024 11:50:46 +0200 From: "Kirill A. Shutemov" To: Dave Chinner Cc: Jens Axboe , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, hannes@cmpxchg.org, clm@meta.com, linux-kernel@vger.kernel.org, willy@infradead.org, linux-btrfs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org Subject: Re: [PATCH 10/16] mm/filemap: make buffered writes work with RWF_UNCACHED Message-ID: <2sjhov4poma4o4efvwe2xk474iorxwvf4ifqa5oee74744ke2e@lipjana3f5ti> References: <20241111234842.2024180-1-axboe@kernel.dk> <20241111234842.2024180-11-axboe@kernel.dk> <0487b852-6e2b-4879-adf1-88ba75bdecc0@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 5BC874000D X-Stat-Signature: owhxb3k5k7cjf59ctm7ca36t4emi5cy6 X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1731405004-415715 X-HE-Meta: U2FsdGVkX1/ein0biehzGuHCXnblE0BeKUp3mm2GhBXigmM9QQs7vxgB3EqDrY3jNFzBMxpKaIV0T+tNhSXiE8k8a7m10oHTwZf0pUH2sQwlSrPKH7FBRBFQtmh28KOobLq84VeM8I3YakySRSquROaMfBjD3pxcxaB1mK3G+czeQtq+jgWVw2dhsUOuFg5Cs3fgbWlKgBajGF0wEO+v8hVwIusHAD9FYH1uq/eaQJisZqCDQ7nhO9on/oi+VEcmGgAP2iPJE5p71MfY0RXgjqbUR2hYAWie6Rqb3yHaNsCtpWUJ7mrvf+dXQd7peu8O43L+f9SwLaJl3+mPJfKDKLLx3q01TS/Dg8Bq4Aa93P0c9skObOM+N9U60t4IO9nYyghp4D5b1xsDfxOCSr5CRyX7Pac3WEmQEafm+uda4tdsDBkcInQZVMCKC0unkaz2RYejn/SupQtFlPXdB+lX7x5A0bgi59kGf0/HHbss3Skdx/WKJz1FLhsCa0GN9pS5cZqjadW6yv7iSBjC/SRWMbuy0Pi2cbcGXd/+ECxyILHPDBdi5sETXkYY7mkd6Yn3OB1RzJEhrt2HdApvfGfeGFyoMQqTi0odBstPDTpPSeA8PnnoaFRiWbguF0y4s4MqUoAw2p1ttVsfERt6CugHmCsFwwKU2xhRTY1Gqu9UvzrMHxO3dHvcjKMnxIw61EhlQpr5Xrxv/WrVIi6pf8FTl5R5DHO01F3lPaMyorEKdieeHP1JUUIr1tYXg2HQxrBSH4lw7E67Jgm30+vgcfvOnK85kjRlDgj9+wmGwVM0C2HzAQbUUsqMxW1eDo4d9ReSI8djH2FLlrf4qnmNNasP5LO+j3VKFpXqBUMDi6PwZ1XpxbkcyuAJUSzD6yvasWul00MxF07nb7rwO9++rJVKFKAStrvpCi67/3KQIo2XnGpslxmK7Gj5LMxdByMDnf9+1Co7IOREqo1aQwveyVJ FrbUh7WG RrfJXzWwXZFF9OtXTMu9S+zMqTWesTYzO4xy7V87nVubaUupqfEV6Oy8BxkGFQOF0DdjZWnqJx7M5CWzwBxEJjnj0FEwmjfVsIpB66Z2V/xuQ6/F/4gKhuhVq46S68a35mMA1KBFC71d3eFKIJf/jCazRguMUldcagGzOBnLkx0g23BevkEPZC83mv1Hm2iaTfFTdo1Tk9iwanCmbd0uRQ/KzfpSHOqNRQa73YfOjZ1SsMFlHXDA8KjoJWBDNyWwr4lbaT9JdW4n/zHmJ9uovVra+05jilOuneA+yvei3SlKZpiSSjQo+7oBx2+eSRpdHkq36sbegqVeVENrSCFbWmvFgLG9Qef0wxR77+j6PcQGuLT4YEithz0foArp5hoMGFZKrp9wi/6Ns/B/N/f0z2TOPQh9skAJJqCBJWSd5JpaGzHNTFcWUPAYEI5mxdiWMiPWwzbxbHbmnpmE= 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 Tue, Nov 12, 2024 at 07:02:33PM +1100, Dave Chinner wrote: > I think the post-IO invalidation that these IOs do is largely > irrelevant to how the page cache processes the write. Indeed, > from userspace, the functionality in this patchset would be > implemented like this: > > oneshot_data_write(fd, buf, len, off) > { > /* write into page cache */ > pwrite(fd, buf, len, off); > > /* force the write through the page cache */ > sync_file_range(fd, off, len, SYNC_FILE_RANGE_WRITE | SYNC_FILE_RANGE_WAIT_AFTER); > > /* Invalidate the single use data in the cache now it is on disk */ > posix_fadvise(fd, off, len, POSIX_FADV_DONTNEED); > } > > Allowing the application to control writeback and invalidation > granularity is a much more flexible solution to the problem here; > when IO is sequential, delayed allocation will be allowed to ensure > large contiguous extents are created and that will greatly reduce > file fragmentation on XFS, btrfs, bcachefs and ext4. For random > writes, it'll submit async IOs in batches... > > Given that io_uring already supports sync_file_range() and > posix_fadvise(), I'm wondering why we need an new IO API to perform > this specific write-through behaviour in a way that is less flexible > than what applications can already implement through existing > APIs.... Attaching the hint to the IO operation allows kernel to keep the data in page cache if it is there for other reason. You cannot do it with a separate syscall. Consider a scenario of a nightly backup of the data. The same data is in cache because the actual workload needs it. You don't want backup task to invalidate the data from cache. Your snippet would do that. -- Kiryl Shutsemau / Kirill A. Shutemov